A, B, K = input().split(" ")
A, B, K = int(A), int(B), int(K)

res = []

for i in range(A, 0, -1):
  if A % i == 0 and B % i == 0:
    res.append(i)

print(res[K-1]) A, B, K = input().split(" ") A input().split(" ") ().split () input split " " B K A, B, K = int(A), int(B), int(K) A int(A) int A B int(B) int B K int(K) int K res = [] res [] for i in range(A, 0, -1):
  if A % i == 0 and B % i == 0:
    res.append(i) i range(A, 0, -1) range A 0 -1 if A % i == 0 and B % i == 0:
    res.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 res.append(i) res.append res append i print(res[K-1]) print res[K-1] res K-1 K 1 K = int(A), int(B), int(K) int(K) K A, B, K = input().split(" ") input().split(" ") A K = input().split(" ") input().split(" ") K B, K = int(A), int(B), int(K) int(B) B A, B, K = int(A), int(B), int(K) int(A) A B, K = input().split(" ") input().split(" ") B res = [] [] res
A, B, K = input().split(" ")
A, B, K = int(A), int(B), int(K)

res = []

for i in range(A, 0, -1):
  if A % i == 0 and B % i == 0:
    res.append(i)

print(res[K-1])