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

mini = min(A, B)
divisors = []
for i in range(1, mini + 1):
    if A % i == 0 and B % i == 0:
        divisors.append(i)

divisors = divisors[::-1]
print(divisors[K - 1]) import sys sys A, B, K = map(int, input().split()) A map(int, input().split()) map int input().split() ().split () input split B K mini = min(A, B) mini min(A, B) min A B divisors = [] divisors [] for i in range(1, mini + 1):
    if A % i == 0 and B % i == 0:
        divisors.append(i) i range(1, mini + 1) range 1 mini + 1 mini 1 if A % i == 0 and B % i == 0:
        divisors.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 divisors.append(i) divisors.append divisors append i divisors = divisors[::-1] divisors divisors[::-1] divisors ::-1 -1 print(divisors[K - 1]) print divisors[K - 1] divisors K - 1 K 1 K = map(int, input().split()) map(int, input().split()) K mini = min(A, B) min(A, B) mini B, K = map(int, input().split()) map(int, input().split()) B divisors = [] [] divisors A, B, K = map(int, input().split()) map(int, input().split()) A divisors = divisors[::-1] divisors[::-1] divisors
import sys
A, B, K = map(int, input().split())

mini = min(A, B)
divisors = []
for i in range(1, mini + 1):
    if A % i == 0 and B % i == 0:
        divisors.append(i)

divisors = divisors[::-1]
print(divisors[K - 1])
