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

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

wari = []
count = 0
for i in range(1,A+B):
    if A%i==0 and B%i==0:
        wari.append(i)
print(wari[len(wari)-K])
