A,B,K=[int(x) for x in input().split(' ')]

lis=[]
blis=[]
count=0

sm=min([A,B])
bm=max([A,B])
for i in range(1,sm+1):
	if sm/i == sm//i:
		lis.append(i)

for i in lis:
	if bm/i == bm//i:
		blis.append(i)

blis=list(set(blis))
blis.sort()
blis.reverse()

print(blis[K-1])


#8 12 2
 int(x) for x in input().split(' ') for x in input().split(' ') x input().split(' ') ().split () input split ' ' for x in input().split(' ') int(x) int x A,B,K=[int(x) for x in input().split(' ')] A [int(x) for x in input().split(' ')] B K lis=[] lis [] blis=[] blis [] count=0 count 0 sm=min([A,B]) sm min([A,B]) min [A,B] A B bm=max([A,B]) bm max([A,B]) max [A,B] A B for i in range(1,sm+1):
	if sm/i == sm//i:
		lis.append(i) i range(1,sm+1) range 1 sm+1 sm 1 if sm/i == sm//i:
		lis.append(i) sm/i == sm//i sm/i sm i sm//i sm i lis.append(i) lis.append lis append i for i in lis:
	if bm/i == bm//i:
		blis.append(i) i lis if bm/i == bm//i:
		blis.append(i) bm/i == bm//i bm/i bm i bm//i bm i blis.append(i) blis.append blis append i blis=list(set(blis)) blis list(set(blis)) list set(blis) set blis blis.sort() blis.sort blis sort blis.reverse() blis.reverse blis reverse print(blis[K-1]) print blis[K-1] blis K-1 K 1 A,B,K=[int(x) for x in input().split(' ')] [int(x) for x in input().split(' ')] A B,K=[int(x) for x in input().split(' ')] [int(x) for x in input().split(' ')] B sm=min([A,B]) min([A,B]) sm blis=list(set(blis)) list(set(blis)) blis blis=[] [] blis K=[int(x) for x in input().split(' ')] [int(x) for x in input().split(' ')] K bm=max([A,B]) max([A,B]) bm count=0 0 count lis=[] [] lis
A,B,K=[int(x) for x in input().split(' ')]

lis=[]
blis=[]
count=0

sm=min([A,B])
bm=max([A,B])
for i in range(1,sm+1):
	if sm/i == sm//i:
		lis.append(i)

for i in lis:
	if bm/i == bm//i:
		blis.append(i)

blis=list(set(blis))
blis.sort()
blis.reverse()

print(blis[K-1])


#8 12 2

