A,B,K = map(int,input().split())

def cf(x1,x2):
    cf=[]
    for i in range(1,min(x1,x2)+1):
        if x1 % i == 0 and x2 % i == 0:
            cf.append(i)
    return cf

print(cf(A,B)[-(K)]) A,B,K = map(int,input().split()) A map(int,input().split()) map int input().split() ().split () input split B K def cf(x1,x2):
    cf=[]
    for i in range(1,min(x1,x2)+1):
        if x1 % i == 0 and x2 % i == 0:
            cf.append(i)
    return cf cf cf=[] cf [] for i in range(1,min(x1,x2)+1):
        if x1 % i == 0 and x2 % i == 0:
            cf.append(i)
     i range(1,min(x1,x2)+1) range 1 min(x1,x2)+1 min(x1,x2) min x1 x2 1 if x1 % i == 0 and x2 % i == 0:
            cf.append(i)
     x1 % i == 0 and x2 % i == 0 x1 % i == 0 x1 % i x1 i 0 x2 % i == 0 x2 % i x2 i 0 cf.append(i) cf.append cf append i return cf cf x1 x1 x2 x2 print(cf(A,B)[-(K)]) print cf(A,B)[-(K)] (A,B) cf A B -(K) K def cf(x1,x2):
    cf=[]
    for i in range(1,min(x1,x2)+1):
        if x1 % i == 0 and x2 % i == 0:
            cf.append(i)
    return cf def cf(x1,x2):
    cf=[]
    for i in range(1,min(x1,x2)+1):
        if x1 % i == 0 and x2 % i == 0:
            cf.append(i)
    return cf cf B,K = map(int,input().split()) map(int,input().split()) B K = map(int,input().split()) map(int,input().split()) K A,B,K = map(int,input().split()) map(int,input().split()) A
A,B,K = map(int,input().split())

def cf(x1,x2):
    cf=[]
    for i in range(1,min(x1,x2)+1):
        if x1 % i == 0 and x2 % i == 0:
            cf.append(i)
    return cf

print(cf(A,B)[-(K)])