A, B, K = list(map(lambda x: int(x), input().split(" ")))
cd = []
for i in range(min([A,B])):
  if A % (i + 1) == 0 and B % (i + 1) == 0:
    cd.append(i+1)
 
print(cd[-K]) A, B, K = list(map(lambda x: int(x), input().split(" "))) A list(map(lambda x: int(x), input().split(" "))) list map(lambda x: int(x), input().split(" ")) map lambda x: int(x) int(x) int x x input().split(" ") ().split () input split " " B K cd = [] cd [] for i in range(min([A,B])):
  if A % (i + 1) == 0 and B % (i + 1) == 0:
    cd.append(i+1)
  i range(min([A,B])) range min([A,B]) min [A,B] A B if A % (i + 1) == 0 and B % (i + 1) == 0:
    cd.append(i+1)
  A % (i + 1) == 0 and B % (i + 1) == 0 A % (i + 1) == 0 A % (i + 1) A i + 1 i 1 0 B % (i + 1) == 0 B % (i + 1) B i + 1 i 1 0 cd.append(i+1) cd.append cd append i+1 i 1 print(cd[-K]) print cd[-K] cd -K K A, B, K = list(map(lambda x: int(x), input().split(" "))) list(map(lambda x: int(x), input().split(" "))) A cd = [] [] cd B, K = list(map(lambda x: int(x), input().split(" "))) list(map(lambda x: int(x), input().split(" "))) B K = list(map(lambda x: int(x), input().split(" "))) list(map(lambda x: int(x), input().split(" "))) K
A, B, K = list(map(lambda x: int(x), input().split(" ")))
cd = []
for i in range(min([A,B])):
  if A % (i + 1) == 0 and B % (i + 1) == 0:
    cd.append(i+1)
 
print(cd[-K])