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