A, B, K = list(map(int, input().split()))
arr = []

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

for i in range(1,101):
  if A%i == 0 and B%i == 0:
    arr.append(i)
print (arr[-K])
