a, b, k = map(int, input().split())
cnt = 0
for i in range(110):
  j = 110 - i
  if a % j == 0 and b % j == 0:
    cnt += 1
  if cnt == k:
    print(j)
    exit() a, b, k = map(int, input().split()) a map(int, input().split()) map int input().split() ().split () input split b k cnt = 0 cnt 0 for i in range(110):
  j = 110 - i
  if a % j == 0 and b % j == 0:
    cnt += 1
  if cnt == k:
    print(j)
    exit() i range(110) range 110 j = 110 - i j 110 - i 110 i if a % j == 0 and b % j == 0:
    cnt += 1
   a % j == 0 and b % j == 0 a % j == 0 a % j a j 0 b % j == 0 b % j b j 0 cnt += 1 cnt 1 if cnt == k:
    print(j)
    exit() cnt == k cnt k print(j) print j exit() exit cnt = 0 0 cnt cnt += 1 1 cnt b, k = map(int, input().split()) map(int, input().split()) b j = 110 - i 110 - i j a, b, k = map(int, input().split()) map(int, input().split()) a k = map(int, input().split()) map(int, input().split()) k
a, b, k = map(int, input().split())
cnt = 0
for i in range(110):
  j = 110 - i
  if a % j == 0 and b % j == 0:
    cnt += 1
  if cnt == k:
    print(j)
    exit()