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

count = []

for i in range(1, min(A, B) + 1, 1):
  if (A % i == 0) and (B % i == 0):
    count.append(i)

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

count = []

for i in range(1, min(A, B) + 1, 1):
  if (A % i == 0) and (B % i == 0):
    count.append(i)

count.sort(reverse = True)
print(count[K - 1])