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

n = 0
d = []
for i in range(1, 101):
    if a % i == 0 and b % i == 0:
        d.append(i)

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

n = 0
d = []
for i in range(1, 101):
    if a % i == 0 and b % i == 0:
        d.append(i)

print(d[-k])