a, b, k = map(int, input().split())
cnt = 0
num = min(a, b) + 1
while cnt < k:
    num -= 1
    if a % num == 0 and b % num == 0:
        cnt += 1
print(num) 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 num = min(a, b) + 1 num min(a, b) + 1 min(a, b) min a b 1 while cnt < k:
    num -= 1
    if a % num == 0 and b % num == 0:
        cnt += 1 cnt < k cnt k num -= 1 num 1 if a % num == 0 and b % num == 0:
        cnt += 1 a % num == 0 and b % num == 0 a % num == 0 a % num a num 0 b % num == 0 b % num b num 0 cnt += 1 cnt 1 print(num) print num num = min(a, b) + 1 min(a, b) + 1 num cnt += 1 1 cnt k = map(int, input().split()) map(int, input().split()) k cnt = 0 0 cnt num -= 1 1 num a, b, k = map(int, input().split()) map(int, input().split()) a b, k = map(int, input().split()) map(int, input().split()) b
a, b, k = map(int, input().split())
cnt = 0
num = min(a, b) + 1
while cnt < k:
    num -= 1
    if a % num == 0 and b % num == 0:
        cnt += 1
print(num)
