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

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

for i in range(max(a, b), 0, -1):
  if a%i ==0 and b%i ==0:
    k -= 1
    if k==0:
      print(i)
      break