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