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