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

min = a
if b < min:
  min = b

ans_lists = []
for i in range(1, min+1, 1):
  if a%i == 0 and b%i == 0:
    ans_lists.append(i)

ans_lists.reverse()
ans = ans_lists[k-1]

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

min = a
if b < min:
  min = b

ans_lists = []
for i in range(1, min+1, 1):
  if a%i == 0 and b%i == 0:
    ans_lists.append(i)

ans_lists.reverse()
ans = ans_lists[k-1]

print(ans)