# abc120_b.py
import fractions 
from functools import reduce
def gcd(*numbers):
    return reduce(fractions.gcd, numbers)
def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)

A, B, K = map(int,input().split())
cnt = 0
_max = gcd(A,B)
while _max>=0:
    if A%_max==0 and B%_max==0:
        cnt += 1
        if cnt == K:
            print(_max)
            exit()
    _max -=1 import fractions fractions from functools import reduce def gcd(*numbers):
    return reduce(fractions.gcd, numbers) gcd return reduce(fractions.gcd, numbers) reduce(fractions.gcd, numbers) reduce fractions.gcd fractions gcd numbers *numbers def gcd_list(numbers):
    return reduce(fractions.gcd, numbers) gcd_list return reduce(fractions.gcd, numbers) reduce(fractions.gcd, numbers) reduce fractions.gcd fractions gcd numbers numbers numbers A, B, K = map(int,input().split()) A map(int,input().split()) map int input().split() ().split () input split B K cnt = 0 cnt 0 _max = gcd(A,B) _max gcd(A,B) gcd A B while _max>=0:
    if A%_max==0 and B%_max==0:
        cnt += 1
        if cnt == K:
            print(_max)
            exit()
    _max -=1 _max>=0 _max 0 if A%_max==0 and B%_max==0:
        cnt += 1
        if cnt == K:
            print(_max)
            exit()
     A%_max==0 and B%_max==0 A%_max==0 A%_max A _max 0 B%_max==0 B%_max B _max 0 cnt += 1 cnt 1 if cnt == K:
            print(_max)
            exit()
     cnt == K cnt K print(_max) print _max exit() exit _max -=1 _max 1 _max -=1 1 _max B, K = map(int,input().split()) map(int,input().split()) B cnt = 0 0 cnt _max = gcd(A,B) gcd(A,B) _max cnt += 1 1 cnt K = map(int,input().split()) map(int,input().split()) K A, B, K = map(int,input().split()) map(int,input().split()) A def gcd(*numbers):
    return reduce(fractions.gcd, numbers) def gcd(*numbers):
    return reduce(fractions.gcd, numbers) gcd def gcd_list(numbers):
    return reduce(fractions.gcd, numbers) def gcd_list(numbers):
    return reduce(fractions.gcd, numbers) gcd_list
# abc120_b.py
import fractions 
from functools import reduce
def gcd(*numbers):
    return reduce(fractions.gcd, numbers)
def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)

A, B, K = map(int,input().split())
cnt = 0
_max = gcd(A,B)
while _max>=0:
    if A%_max==0 and B%_max==0:
        cnt += 1
        if cnt == K:
            print(_max)
            exit()
    _max -=1
