def i():
	return int(input())
def i2():
	return map(int,input().split())
def s():
	return str(input())
def l():
	return list(input())
def intl():
	return list(int(k) for k in input().split())

a,b,k = i2()
ans = []*100
for i in range( 1,min(a,b)+1 ):
	if a%i==0 and b%i==0:
		ans.append(i)
print(ans[-k]) def i():
	return int(input()) i return int(input()) int(input()) int input() input def i2():
	return map(int,input().split()) i2 return map(int,input().split()) map(int,input().split()) map int input().split() ().split () input split def s():
	return str(input()) s return str(input()) str(input()) str input() input def l():
	return list(input()) l return list(input()) list(input()) list input() input def intl():
	return list(int(k) for k in input().split()) intl return list(int(k) for k in input().split()) list(int(k) for k in input().split()) list int(k) int k a,b,k = i2() a i2() i2 b k ans = []*100 ans []*100 [] 100 for i in range( 1,min(a,b)+1 ):
	if a%i==0 and b%i==0:
		ans.append(i) i range( 1,min(a,b)+1 ) range 1 min(a,b)+1 min(a,b) min a b 1 if a%i==0 and b%i==0:
		ans.append(i) a%i==0 and b%i==0 a%i==0 a%i a i 0 b%i==0 b%i b i 0 ans.append(i) ans.append ans append i print(ans[-k]) print ans[-k] ans -k k def intl():
	return list(int(k) for k in input().split()) def intl():
	return list(int(k) for k in input().split()) intl b,k = i2() i2() b def i():
	return int(input()) def i():
	return int(input()) i def s():
	return str(input()) def s():
	return str(input()) s a,b,k = i2() i2() a ans = []*100 []*100 ans def l():
	return list(input()) def l():
	return list(input()) l k = i2() i2() k def i2():
	return map(int,input().split()) def i2():
	return map(int,input().split()) i2
def i():
	return int(input())
def i2():
	return map(int,input().split())
def s():
	return str(input())
def l():
	return list(input())
def intl():
	return list(int(k) for k in input().split())

a,b,k = i2()
ans = []*100
for i in range( 1,min(a,b)+1 ):
	if a%i==0 and b%i==0:
		ans.append(i)
print(ans[-k])