import math
a, b, k = map(int, input().split())
l = []

for i in range(1, math.gcd(a, b)+1):
    if a % i == 0 and b % i == 0:
        l.append(i)

L = sorted(l)
print(L[-k]) import math math a, b, k = map(int, input().split()) a map(int, input().split()) map int input().split() ().split () input split b k l = [] l [] for i in range(1, math.gcd(a, b)+1):
    if a % i == 0 and b % i == 0:
        l.append(i) i range(1, math.gcd(a, b)+1) range 1 math.gcd(a, b)+1 math.gcd(a, b) math.gcd math gcd a b 1 if a % i == 0 and b % i == 0:
        l.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 l.append(i) l.append l append i L = sorted(l) L sorted(l) sorted l print(L[-k]) print L[-k] L -k k a, b, k = map(int, input().split()) map(int, input().split()) a L = sorted(l) sorted(l) L b, k = map(int, input().split()) map(int, input().split()) b l = [] [] l k = map(int, input().split()) map(int, input().split()) k
import math
a, b, k = map(int, input().split())
l = []

for i in range(1, math.gcd(a, b)+1):
    if a % i == 0 and b % i == 0:
        l.append(i)

L = sorted(l)
print(L[-k])