a,b,k = map(int, input().split())
i = 1
l = []
while i <= min(a,b):
  if a%i == 0 and b%i == 0:
    l.append(i)
  i += 1
print(l[len(l)-k]) a,b,k = map(int, input().split()) a map(int, input().split()) map int input().split() ().split () input split b k i = 1 i 1 l = [] l [] while i <= min(a,b):
  if a%i == 0 and b%i == 0:
    l.append(i)
  i += 1 i <= min(a,b) i min(a,b) min a b 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 i += 1 i 1 print(l[len(l)-k]) print l[len(l)-k] l len(l)-k len(l) len l k k = map(int, input().split()) map(int, input().split()) k l = [] [] l b,k = map(int, input().split()) map(int, input().split()) b i = 1 1 i a,b,k = map(int, input().split()) map(int, input().split()) a i += 1 1 i
a,b,k = map(int, input().split())
i = 1
l = []
while i <= min(a,b):
  if a%i == 0 and b%i == 0:
    l.append(i)
  i += 1
print(l[len(l)-k])