#! python3
#  solve_120_B.py

import math

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

gcd_of_AB = math.gcd(A,B)
l = []

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

print(l[len(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 gcd_of_AB = math.gcd(A,B) gcd_of_AB math.gcd(A,B) math.gcd math gcd A B l = [] l [] for i in range(1,gcd_of_AB+1):
    if gcd_of_AB % i == 0:
        l.append(i) i range(1,gcd_of_AB+1) range 1 gcd_of_AB+1 gcd_of_AB 1 if gcd_of_AB % i == 0:
        l.append(i) gcd_of_AB % i == 0 gcd_of_AB % i gcd_of_AB i 0 l.append(i) l.append l append i print(l[len(l)-K]) print l[len(l)-K] l len(l)-K len(l) len l K l = [] [] l K = map(int,input().split()) map(int,input().split()) K gcd_of_AB = math.gcd(A,B) math.gcd(A,B) gcd_of_AB B,K = map(int,input().split()) map(int,input().split()) B A,B,K = map(int,input().split()) map(int,input().split()) A
#! python3
#  solve_120_B.py

import math

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

gcd_of_AB = math.gcd(A,B)
l = []

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

print(l[len(l)-K])