A, B, K = map(int, input().split())
if A > B:
    num = A
    A = B
    B = num
flag = 0
count = 0
el = []
for i in range(1,A+1):
    if A % i == 0 and B % i == 0:
        el.append(i)


print(el[-K]) A, B, K = map(int, input().split()) A map(int, input().split()) map int input().split() ().split () input split B K if A > B:
    num = A
    A = B
    B = num A > B A B num = A num A A = B A B B = num B num flag = 0 flag 0 count = 0 count 0 el = [] el [] for i in range(1,A+1):
    if A % i == 0 and B % i == 0:
        el.append(i) i range(1,A+1) range 1 A+1 A 1 if A % i == 0 and B % i == 0:
        el.append(i) A % i == 0 and B % i == 0 A % i == 0 A % i A i 0 B % i == 0 B % i B i 0 el.append(i) el.append el append i print(el[-K]) print el[-K] el -K K K = map(int, input().split()) map(int, input().split()) K num = A A num B = num num B count = 0 0 count el = [] [] el A, B, K = map(int, input().split()) map(int, input().split()) A B, K = map(int, input().split()) map(int, input().split()) B flag = 0 0 flag A = B B A
A, B, K = map(int, input().split())
if A > B:
    num = A
    A = B
    B = num
flag = 0
count = 0
el = []
for i in range(1,A+1):
    if A % i == 0 and B % i == 0:
        el.append(i)


print(el[-K])