split = input().split()
a = int(split[0])
b = int(split[1])
c = int(split[2])
nums = []

check = a if a < b else b

for i in range(1, check + 1, 1):
    if a % i == 0 and b % i == 0:
        nums.append(i)
print(nums[-c]) split = input().split() split input().split() ().split () input split a = int(split[0]) a int(split[0]) int split[0] split 0 b = int(split[1]) b int(split[1]) int split[1] split 1 c = int(split[2]) c int(split[2]) int split[2] split 2 nums = [] nums [] check = a if a < b else b check a if a < b else b a < b a b a b for i in range(1, check + 1, 1):
    if a % i == 0 and b % i == 0:
        nums.append(i) i range(1, check + 1, 1) range 1 check + 1 check 1 1 if a % i == 0 and b % i == 0:
        nums.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 nums.append(i) nums.append nums append i print(nums[-c]) print nums[-c] nums -c c c = int(split[2]) int(split[2]) c split = input().split() input().split() split a = int(split[0]) int(split[0]) a nums = [] [] nums check = a if a < b else b a if a < b else b check b = int(split[1]) int(split[1]) b
split = input().split()
a = int(split[0])
b = int(split[1])
c = int(split[2])
nums = []

check = a if a < b else b

for i in range(1, check + 1, 1):
    if a % i == 0 and b % i == 0:
        nums.append(i)
print(nums[-c])