import math

a,b,k=map(int,input().split())

c=math.gcd(a,b)

d=[i for i in range(1,c+1) if c%i==0]

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

a,b,k=map(int,input().split())

c=math.gcd(a,b)

d=[i for i in range(1,c+1) if c%i==0]

print(d[-k])