temp = []

l = []

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



for i in range(1, a + 1):

    if a % i == 0:

        temp.append(i)



for i in range(1, b + 1):

    if b % i == 0 and i in temp:

        l.append(i)



print((l[k * -1]))
a, b, k = list(map(int, input().split()))

l = [i for i in range(1, min(a, b) + 1) if not (a % i or b % i)]

print((l[-k]))

temp = []
l = []
a, b, k = list(map(int, input().split()))
for i in range(1, a + 1):
    if a % i == 0:
        temp.append(i)
for i in range(1, b + 1):
    if b % i == 0 and i in temp:
        l.append(i)
print((l[k * -1]))

a, b, k = list(map(int, input().split()))
l = [i for i in range(1, min(a, b) + 1) if not (a % i or b % i)]
print((l[-k]))

-temp = [] -l = [] -for i in range(1, a + 1): -    if a % i == 0: -        temp.append(i) -for i in range(1, b + 1): -    if b % i == 0 and i in temp: -        l.append(i) -print((l[k * -1])) +l = [i for i in range(1, min(a, b) + 1) if not (a % i or b % i)] +print((l[-k]))