from math import gcd

a, b, k = map(int, open(0).read().split())

g = gcd(a, b)

cd = []

for i in range(1, g+1):
    if g%i==0:
        cd.append(i)

print(cd[-k]) from math import gcd a, b, k = map(int, open(0).read().split()) a map(int, open(0).read().split()) map int open(0).read().split() (0).read().split (0).read() (0).read (0) open 0 read split b k g = gcd(a, b) g gcd(a, b) gcd a b cd = [] cd [] for i in range(1, g+1):
    if g%i==0:
        cd.append(i) i range(1, g+1) range 1 g+1 g 1 if g%i==0:
        cd.append(i) g%i==0 g%i g i 0 cd.append(i) cd.append cd append i print(cd[-k]) print cd[-k] cd -k k g = gcd(a, b) gcd(a, b) g b, k = map(int, open(0).read().split()) map(int, open(0).read().split()) b cd = [] [] cd a, b, k = map(int, open(0).read().split()) map(int, open(0).read().split()) a k = map(int, open(0).read().split()) map(int, open(0).read().split()) k
from math import gcd

a, b, k = map(int, open(0).read().split())

g = gcd(a, b)

cd = []

for i in range(1, g+1):
    if g%i==0:
        cd.append(i)

print(cd[-k])