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

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

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