a, b, k = list(map(int, input().split()))
l = []
c = a
if (a > b):
  c = b
for i in range(1, c+1):
  if a % i == 0 and b % i == 0:
    l.append(i)
l.sort()
print(l[-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 l = [] l [] c = a c a if (a > b):
  c = b a > b a b c = b c b for i in range(1, c+1):
  if a % i == 0 and b % i == 0:
    l.append(i) i range(1, c+1) range 1 c+1 c 1 if a % i == 0 and b % i == 0:
    l.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 l.append(i) l.append l append i l.sort() l.sort l sort print(l[-k]) print l[-k] l -k k c = b b c a, b, k = list(map(int, input().split())) list(map(int, input().split())) a l = [] [] l b, k = list(map(int, input().split())) list(map(int, input().split())) b k = list(map(int, input().split())) list(map(int, input().split())) k c = a a c
a, b, k = list(map(int, input().split()))
l = []
c = a
if (a > b):
  c = b
for i in range(1, c+1):
  if a % i == 0 and b % i == 0:
    l.append(i)
l.sort()
print(l[-k])
