A, B, K = map(int, input().split())
I = []
if A < B:
    C = A
else:
    C = B
for i in range(1, C+1):
    if (A % i == 0) & (B % i == 0):
        I.append(i)
print(I[-K]) A, B, K = map(int, input().split()) A map(int, input().split()) map int input().split() ().split () input split B K I = [] I [] if A < B:
    C = A
else:
    C = B A < B A B C = A C A C = B C B for i in range(1, C+1):
    if (A % i == 0) & (B % i == 0):
        I.append(i) i range(1, C+1) range 1 C+1 C 1 if (A % i == 0) & (B % i == 0):
        I.append(i) (A % i == 0) & (B % i == 0) A % i == 0 A % i A i 0 B % i == 0 B % i B i 0 I.append(i) I.append I append i print(I[-K]) print I[-K] I -K K K = map(int, input().split()) map(int, input().split()) K I = [] [] I A, B, K = map(int, input().split()) map(int, input().split()) A C = A A C B, K = map(int, input().split()) map(int, input().split()) B C = B B C
A, B, K = map(int, input().split())
I = []
if A < B:
    C = A
else:
    C = B
for i in range(1, C+1):
    if (A % i == 0) & (B % i == 0):
        I.append(i)
print(I[-K])
