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

c = 0

i = max(a,b)



while i > 0:

    if a % i == 0:

        if b % i == 0:

            c += 1



    if c == k:

        print(i)

        break



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

t = []

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

    if a % i == 0 and b % i == 0:

        t.append(i)

t.sort(reverse=True)

print((t[k-1]))
a, b, k = list(map(int, input().split()))
c = 0
i = max(a, b)
while i > 0:
    if a % i == 0:
        if b % i == 0:
            c += 1
    if c == k:
        print(i)
        break
    i -= 1

a, b, k = list(map(int, input().split()))
t = []
for i in range(1, 100 + 1):
    if a % i == 0 and b % i == 0:
        t.append(i)
t.sort(reverse=True)
print((t[k - 1]))

-c = 0 -i = max(a, b) -while i > 0: -    if a % i == 0: -        if b % i == 0: -            c += 1 -    if c == k: -        print(i) -        break -    i -= 1 +t = [] +for i in range(1, 100 + 1): +    if a % i == 0 and b % i == 0: +        t.append(i) +t.sort(reverse=True) +print((t[k - 1]))