a, b, k = map(int, input().split())
n = []
for x in range(1, min(a, b) + 1):
    if a % x == 0 and b % x == 0:
        n.append(x)
print(tuple(reversed(n))[k - 1]) a, b, k = map(int, input().split()) a map(int, input().split()) map int input().split() ().split () input split b k n = [] n [] for x in range(1, min(a, b) + 1):
    if a % x == 0 and b % x == 0:
        n.append(x) x range(1, min(a, b) + 1) range 1 min(a, b) + 1 min(a, b) min a b 1 if a % x == 0 and b % x == 0:
        n.append(x) a % x == 0 and b % x == 0 a % x == 0 a % x a x 0 b % x == 0 b % x b x 0 n.append(x) n.append n append x print(tuple(reversed(n))[k - 1]) print tuple(reversed(n))[k - 1] (reversed(n)) tuple reversed(n) reversed n k - 1 k 1 a, b, k = map(int, input().split()) map(int, input().split()) a n = [] [] n k = map(int, input().split()) map(int, input().split()) k b, k = map(int, input().split()) map(int, input().split()) b
a, b, k = map(int, input().split())
n = []
for x in range(1, min(a, b) + 1):
    if a % x == 0 and b % x == 0:
        n.append(x)
print(tuple(reversed(n))[k - 1])