from fractions import gcd

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

g = gcd(a,b)

n = [i for i in range(1,g+1) if g%i==0]

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

num = []

for i in range(1,101):

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

        num.append(i)

print((num[-k]))

from fractions import gcd

a, b, k = list(map(int, input().split()))
g = gcd(a, b)
n = [i for i in range(1, g + 1) if g % i == 0]
print((n[-k]))

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

-from fractions import gcd - -g = gcd(a, b) -n = [i for i in range(1, g + 1) if g % i == 0] -print((n[-k])) +num = [] +for i in range(1, 101): +    if a % i == 0 and b % i == 0: +        num.append(i) +print((num[-k]))