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

anslist = []
for i in range(1,max(A,B)+1):
    if A % i == 0 and B % i == 0:
        anslist.append(i)

print(anslist[-K]) A,B,K = map(int,input().split()) A map(int,input().split()) map int input().split() ().split () input split B K anslist = [] anslist [] for i in range(1,max(A,B)+1):
    if A % i == 0 and B % i == 0:
        anslist.append(i) i range(1,max(A,B)+1) range 1 max(A,B)+1 max(A,B) max A B 1 if A % i == 0 and B % i == 0:
        anslist.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 anslist.append(i) anslist.append anslist append i print(anslist[-K]) print anslist[-K] anslist -K K A,B,K = map(int,input().split()) map(int,input().split()) A B,K = map(int,input().split()) map(int,input().split()) B anslist = [] [] anslist K = map(int,input().split()) map(int,input().split()) K
A,B,K = map(int,input().split())

anslist = []
for i in range(1,max(A,B)+1):
    if A % i == 0 and B % i == 0:
        anslist.append(i)

print(anslist[-K])
