a,b,c = map(int,input().split())
count = int(0)
i = int(0)

if (a == 0) or (b == 0):
    i = 0
else:
    for i in range(1,100):
            if ((a % i) == 0) and ((b % i) == 0):
                count += 1
                if count >= c:
                   break

print(i)