a, b, k = [int(i) for i in input().split()]
ans = []
if a > b:
    n = a
elif a < b:
    n = b
else:
    n = a

for x in range(1,n+1):
    if b % x == 0:
        if a % x == 0:
            ans.append(x)

print(ans[-k]) int(i) for i in input().split() for i in input().split() i input().split() ().split () input split for i in input().split() int(i) int i a, b, k = [int(i) for i in input().split()] a [int(i) for i in input().split()] b k ans = [] ans [] if a > b:
    n = a
elif a < b:
    n = b
else:
    n = a a > b a b n = a n a elif a < b:
    n = b a < b a b n = b n b n = a n a for x in range(1,n+1):
    if b % x == 0:
        if a % x == 0:
            ans.append(x) x range(1,n+1) range 1 n+1 n 1 if b % x == 0:
        if a % x == 0:
            ans.append(x) b % x == 0 b % x b x 0 if a % x == 0:
            ans.append(x) a % x == 0 a % x a x 0 ans.append(x) ans.append ans append x print(ans[-k]) print ans[-k] ans -k k n = a a n n = a a n n = b b n ans = [] [] ans k = [int(i) for i in input().split()] [int(i) for i in input().split()] k b, k = [int(i) for i in input().split()] [int(i) for i in input().split()] b a, b, k = [int(i) for i in input().split()] [int(i) for i in input().split()] a
a, b, k = [int(i) for i in input().split()]
ans = []
if a > b:
    n = a
elif a < b:
    n = b
else:
    n = a

for x in range(1,n+1):
    if b % x == 0:
        if a % x == 0:
            ans.append(x)

print(ans[-k])