a,b,k=map(int, input().split())
alist=[]
cnt=0
for i in range(1,101):
  if a%i==0 and b%i==0:
    alist.append(i)
    cnt+=1
print(alist[cnt-k]) a,b,k=map(int, input().split()) a map(int, input().split()) map int input().split() ().split () input split b k alist=[] alist [] cnt=0 cnt 0 for i in range(1,101):
  if a%i==0 and b%i==0:
    alist.append(i)
    cnt+=1 i range(1,101) range 1 101 if a%i==0 and b%i==0:
    alist.append(i)
    cnt+=1 a%i==0 and b%i==0 a%i==0 a%i a i 0 b%i==0 b%i b i 0 alist.append(i) alist.append alist append i cnt+=1 cnt 1 print(alist[cnt-k]) print alist[cnt-k] alist cnt-k cnt k alist=[] [] alist cnt+=1 1 cnt a,b,k=map(int, input().split()) map(int, input().split()) a cnt=0 0 cnt k=map(int, input().split()) map(int, input().split()) k b,k=map(int, input().split()) map(int, input().split()) b
a,b,k=map(int, input().split())
alist=[]
cnt=0
for i in range(1,101):
  if a%i==0 and b%i==0:
    alist.append(i)
    cnt+=1
print(alist[cnt-k])