a, b, k = map(int, input().split())
cnt = 0
i = 0
lst = []
while i <= max(a,b):
	i += 1
	if a % i == 0 and b % i == 0:
		lst.append(i)
print(lst[-k])
 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 i = 0 i 0 lst = [] lst [] while i <= max(a,b):
	i += 1
	if a % i == 0 and b % i == 0:
		lst.append(i) i <= max(a,b) i max(a,b) max a b i += 1 i 1 if a % i == 0 and b % i == 0:
		lst.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 lst.append(i) lst.append lst append i print(lst[-k]) print lst[-k] lst -k k cnt = 0 0 cnt lst = [] [] lst a, b, k = map(int, input().split()) map(int, input().split()) a i = 0 0 i k = map(int, input().split()) map(int, input().split()) k i += 1 1 i b, k = map(int, input().split()) map(int, input().split()) b
a, b, k = map(int, input().split())
cnt = 0
i = 0
lst = []
while i <= max(a,b):
	i += 1
	if a % i == 0 and b % i == 0:
		lst.append(i)
print(lst[-k])

