a,b,k=map(int, input().split())
for i in reversed(range(1,min(a,b)+1)):
  if a%i==0 and b%i==0 :
    k=k-1
  if k==0:
    print(i)
    break a,b,k=map(int, input().split()) a map(int, input().split()) map int input().split() ().split () input split b k for i in reversed(range(1,min(a,b)+1)):
  if a%i==0 and b%i==0 :
    k=k-1
  if k==0:
    print(i)
    break i reversed(range(1,min(a,b)+1)) reversed range(1,min(a,b)+1) range 1 min(a,b)+1 min(a,b) min a b 1 if a%i==0 and b%i==0 :
    k=k-1
   a%i==0 and b%i==0 a%i==0 a%i a i 0 b%i==0 b%i b i 0 k=k-1 k k-1 k 1 if k==0:
    print(i)
    break k==0 k 0 print(i) print i break b,k=map(int, input().split()) map(int, input().split()) b k=map(int, input().split()) map(int, input().split()) k a,b,k=map(int, input().split()) map(int, input().split()) a k=k-1 k-1 k
a,b,k=map(int, input().split())
for i in reversed(range(1,min(a,b)+1)):
  if a%i==0 and b%i==0 :
    k=k-1
  if k==0:
    print(i)
    break