A,B,K = list(map(int,input().split()))



count_list = []

for i in range(1,101):

    if A%i==0 and B%i==0:

        count_list.append(i)

print((count_list[-K]))

A,B,K = list(map(int,input().split()))



count_list = [i for i in range(1,101) if A%i==0 and B%i==0]

print((count_list[-K]))

A, B, K = list(map(int, input().split()))
count_list = []
for i in range(1, 101):
    if A % i == 0 and B % i == 0:
        count_list.append(i)
print((count_list[-K]))

A, B, K = list(map(int, input().split()))
count_list = [i for i in range(1, 101) if A % i == 0 and B % i == 0]
print((count_list[-K]))

-count_list = [] -for i in range(1, 101): -    if A % i == 0 and B % i == 0: -        count_list.append(i) +count_list = [i for i in range(1, 101) if A % i == 0 and B % i == 0]