a,b,k=map(int,input().split())
cnt=0
mylist=[]
for i in range(1,10001):
    if a%i==0 and b%i==0:
        mylist.append(i)
print(mylist[-k]) a,b,k=map(int,input().split()) a map(int,input().split()) map int input().split() ().split () input split b k cnt=0 cnt 0 mylist=[] mylist [] for i in range(1,10001):
    if a%i==0 and b%i==0:
        mylist.append(i) i range(1,10001) range 1 10001 if a%i==0 and b%i==0:
        mylist.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 mylist.append(i) mylist.append mylist append i print(mylist[-k]) print mylist[-k] mylist -k k cnt=0 0 cnt 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 mylist=[] [] mylist
a,b,k=map(int,input().split())
cnt=0
mylist=[]
for i in range(1,10001):
    if a%i==0 and b%i==0:
        mylist.append(i)
print(mylist[-k])