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