A,B,K = map(int,input().split())
list=[]
for i in range(1,101):
    if A%i==0 and B%i==0:
        list.append(i)
list.sort(reverse=True)
#print(list)
print(list[K-1]) A,B,K = map(int,input().split()) A map(int,input().split()) map int input().split() ().split () input split B K list=[] list [] for i in range(1,101):
    if A%i==0 and B%i==0:
        list.append(i) i range(1,101) range 1 101 if A%i==0 and B%i==0:
        list.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 list.append(i) list.append list append i list.sort(reverse=True) list.sort list sort reverse=True reverse True print(list[K-1]) print list[K-1] list K-1 K 1 A,B,K = map(int,input().split()) map(int,input().split()) A list=[] [] list 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())
list=[]
for i in range(1,101):
    if A%i==0 and B%i==0:
        list.append(i)
list.sort(reverse=True)
#print(list)
print(list[K-1])
