a,b,k = map(int,input().split())
lst = []
end = min(a,b) #実際の終わり

for i in range(1,end+1):
    ra = a % i
    rb = b % i
    if ra == 0 and rb == 0:
        lst.append(i)

ans = lst[-1*k]
print(ans) a,b,k = map(int,input().split()) a map(int,input().split()) map int input().split() ().split () input split b k lst = [] lst [] end = min(a,b) end min(a,b) min a b for i in range(1,end+1):
    ra = a % i
    rb = b % i
    if ra == 0 and rb == 0:
        lst.append(i) i range(1,end+1) range 1 end+1 end 1 ra = a % i ra a % i a i rb = b % i rb b % i b i if ra == 0 and rb == 0:
        lst.append(i) ra == 0 and rb == 0 ra == 0 ra 0 rb == 0 rb 0 lst.append(i) lst.append lst append i ans = lst[-1*k] ans lst[-1*k] lst -1*k -1 k print(ans) print ans b,k = map(int,input().split()) map(int,input().split()) b end = min(a,b) min(a,b) end k = map(int,input().split()) map(int,input().split()) k lst = [] [] lst rb = b % i b % i rb ans = lst[-1*k] lst[-1*k] ans ra = a % i a % i ra a,b,k = map(int,input().split()) map(int,input().split()) a
a,b,k = map(int,input().split())
lst = []
end = min(a,b) #実際の終わり

for i in range(1,end+1):
    ra = a % i
    rb = b % i
    if ra == 0 and rb == 0:
        lst.append(i)

ans = lst[-1*k]
print(ans)