a, b, k = map(int, input().split())

com_dev = [1]

for i in range(2, 101):
  
    if a % i == 0 and b % i == 0:
        com_dev.append(i)

print(com_dev[len(com_dev) - k]) a, b, k = map(int, input().split()) a map(int, input().split()) map int input().split() ().split () input split b k com_dev = [1] com_dev [1] 1 for i in range(2, 101):
  
    if a % i == 0 and b % i == 0:
        com_dev.append(i) i range(2, 101) range 2 101 if a % i == 0 and b % i == 0:
        com_dev.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 com_dev.append(i) com_dev.append com_dev append i print(com_dev[len(com_dev) - k]) print com_dev[len(com_dev) - k] com_dev len(com_dev) - k len(com_dev) len com_dev k b, k = map(int, input().split()) map(int, input().split()) b k = map(int, input().split()) map(int, input().split()) k com_dev = [1] [1] com_dev a, b, k = map(int, input().split()) map(int, input().split()) a
a, b, k = map(int, input().split())

com_dev = [1]

for i in range(2, 101):
  
    if a % i == 0 and b % i == 0:
        com_dev.append(i)

print(com_dev[len(com_dev) - k])