a,b,k=map(int,input().split())
cnt=0
for i in reversed(range(1,101)):
  if a%i==0 and b%i==0:
    cnt+=1
  if cnt==k:
    print(i)
    break 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 for i in reversed(range(1,101)):
  if a%i==0 and b%i==0:
    cnt+=1
  if cnt==k:
    print(i)
    break i reversed(range(1,101)) reversed range(1,101) range 1 101 if a%i==0 and b%i==0:
    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 cnt+=1 cnt 1 if cnt==k:
    print(i)
    break cnt==k cnt k print(i) print i break 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 cnt+=1 1 cnt
a,b,k=map(int,input().split())
cnt=0
for i in reversed(range(1,101)):
  if a%i==0 and b%i==0:
    cnt+=1
  if cnt==k:
    print(i)
    break