a,b,k=map(int,input().split())

Min=min(a,b)

l=[]

for i in range(Min,0,-1):
  if a%i==0 and b%i==0:
    l.append(i)

#print(l)

print(l[k-1]) a,b,k=map(int,input().split()) a map(int,input().split()) map int input().split() ().split () input split b k Min=min(a,b) Min min(a,b) min a b l=[] l [] for i in range(Min,0,-1):
  if a%i==0 and b%i==0:
    l.append(i)

#print(l) i range(Min,0,-1) range Min 0 -1 if a%i==0 and b%i==0:
    l.append(i)

#print(l) a%i==0 and b%i==0 a%i==0 a%i a i 0 b%i==0 b%i b i 0 l.append(i) l.append l append i print(l[k-1]) print l[k-1] l k-1 k 1 a,b,k=map(int,input().split()) map(int,input().split()) a k=map(int,input().split()) map(int,input().split()) k Min=min(a,b) min(a,b) Min l=[] [] l b,k=map(int,input().split()) map(int,input().split()) b
a,b,k=map(int,input().split())

Min=min(a,b)

l=[]

for i in range(Min,0,-1):
  if a%i==0 and b%i==0:
    l.append(i)

#print(l)

print(l[k-1])