import math
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort()
    return divisors

a,b,c=map(int,input().split())
n=math.gcd(a,b)
ans=make_divisors(n)
print(ans[-c]) import math math def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort()
    return divisors make_divisors divisors = [] divisors [] for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

     i range(1, int(n**0.5)+1) range 1 int(n**0.5)+1 int(n**0.5) int n**0.5 n 0.5 1 if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

     n % i == 0 n % i n i 0 divisors.append(i) divisors.append divisors append i if i != n // i:
                divisors.append(n//i)

     i != n // i i n // i n i divisors.append(n//i) divisors.append divisors append n//i n i divisors.sort() divisors.sort divisors sort return divisors divisors n n a,b,c=map(int,input().split()) a map(int,input().split()) map int input().split() ().split () input split b c n=math.gcd(a,b) n math.gcd(a,b) math.gcd math gcd a b ans=make_divisors(n) ans make_divisors(n) make_divisors n print(ans[-c]) print ans[-c] ans -c c a,b,c=map(int,input().split()) map(int,input().split()) a def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort()
    return divisors def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort()
    return divisors make_divisors ans=make_divisors(n) make_divisors(n) ans c=map(int,input().split()) map(int,input().split()) c n=math.gcd(a,b) math.gcd(a,b) n b,c=map(int,input().split()) map(int,input().split()) b
import math
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort()
    return divisors

a,b,c=map(int,input().split())
n=math.gcd(a,b)
ans=make_divisors(n)
print(ans[-c])