a, b, k  = map(int, input().split())
c = 0
ans = []
if a > b:
  c = b
else:
  c = a

for i in range(1, c+1):
  if a % i == 0 and b % i == 0:
    ans.append(i)
  else:
    continue


print(ans[-k]) a, b, k  = map(int, input().split()) a map(int, input().split()) map int input().split() ().split () input split b k c = 0 c 0 ans = [] ans [] if a > b:
  c = b
else:
  c = a a > b a b c = b c b c = a c a for i in range(1, c+1):
  if a % i == 0 and b % i == 0:
    ans.append(i)
  else:
    continue i range(1, c+1) range 1 c+1 c 1 if a % i == 0 and b % i == 0:
    ans.append(i)
  else:
    continue a % i == 0 and b % i == 0 a % i == 0 a % i a i 0 b % i == 0 b % i b i 0 ans.append(i) ans.append ans append i continue print(ans[-k]) print ans[-k] ans -k k b, k  = map(int, input().split()) map(int, input().split()) b k  = map(int, input().split()) map(int, input().split()) k c = 0 0 c a, b, k  = map(int, input().split()) map(int, input().split()) a c = a a c ans = [] [] ans c = b b c
a, b, k  = map(int, input().split())
c = 0
ans = []
if a > b:
  c = b
else:
  c = a

for i in range(1, c+1):
  if a % i == 0 and b % i == 0:
    ans.append(i)
  else:
    continue


print(ans[-k])