a,b,k = map(int,input().split())
num=[]
for i in range(100):
    if(a%(i+1) == 0 and b%( i+1)==0):
        num.append(str(i+1))
x = len(num)
#print("num:"+str(num))
#print("x:"+ str(x))
print(num[x-k]) a,b,k = map(int,input().split()) a map(int,input().split()) map int input().split() ().split () input split b k num=[] num [] for i in range(100):
    if(a%(i+1) == 0 and b%( i+1)==0):
        num.append(str(i+1)) i range(100) range 100 if(a%(i+1) == 0 and b%( i+1)==0):
        num.append(str(i+1)) a%(i+1) == 0 and b%( i+1)==0 a%(i+1) == 0 a%(i+1) a i+1 i 1 0 b%( i+1)==0 b%( i+1) b i+1 i 1 0 num.append(str(i+1)) num.append num append str(i+1) str i+1 i 1 x = len(num) x len(num) len num print(num[x-k]) print num[x-k] num x-k x k x = len(num) len(num) x a,b,k = map(int,input().split()) map(int,input().split()) a k = map(int,input().split()) map(int,input().split()) k b,k = map(int,input().split()) map(int,input().split()) b num=[] [] num
a,b,k = map(int,input().split())
num=[]
for i in range(100):
    if(a%(i+1) == 0 and b%( i+1)==0):
        num.append(str(i+1))
x = len(num)
#print("num:"+str(num))
#print("x:"+ str(x))
print(num[x-k])