a, b, k = map(int, input().split())
c = []
for i in range(1, 101):
    if a % i == 0:
        if b % i == 0:
            c.append(i)
print(c[-k]) a, b, k = map(int, input().split()) a map(int, input().split()) map int input().split() ().split () input split b k c = [] c [] for i in range(1, 101):
    if a % i == 0:
        if b % i == 0:
            c.append(i) i range(1, 101) range 1 101 if a % i == 0:
        if b % i == 0:
            c.append(i) a % i == 0 a % i a i 0 if b % i == 0:
            c.append(i) b % i == 0 b % i b i 0 c.append(i) c.append c append i print(c[-k]) print c[-k] c -k k k = map(int, input().split()) map(int, input().split()) k c = [] [] c a, b, k = map(int, input().split()) map(int, input().split()) a b, k = map(int, input().split()) map(int, input().split()) b
a, b, k = map(int, input().split())
c = []
for i in range(1, 101):
    if a % i == 0:
        if b % i == 0:
            c.append(i)
print(c[-k])