
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(str(i))

print(i_list[len(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(str(i)) i range(1, A + 1) range 1 A + 1 A 1 if A % i == 0 and B % i == 0:
        i_list.append(str(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(str(i)) i_list.append i_list append str(i) str i print(i_list[len(i_list) - K]) print i_list[len(i_list) - K] i_list len(i_list) - K len(i_list) len i_list K i_list = [] [] i_list A, B, K = map(int, input().split()) map(int, input().split()) A K = map(int, input().split()) map(int, input().split()) K B, K = map(int, input().split()) map(int, input().split()) B

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(str(i))

print(i_list[len(i_list) - K])