a, b, k = [int(i) for i in input().split()]

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

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