def gcd(a,b):
    if b == 0:
        return a
    else:
        return gcd(b,a%b)

a,b,k = map(int,input().split())
r = gcd(a,b)
e = []
for i in range(1,r+1):
    if r%i == 0:
        e.append(i)
print(e[len(e)-k]) def gcd(a,b):
    if b == 0:
        return a
    else:
        return gcd(b,a%b) gcd if b == 0:
        return a
    else:
        return gcd(b,a%b) b == 0 b 0 return a a return gcd(b,a%b) gcd(b,a%b) gcd b a%b a b a a b b a,b,k = map(int,input().split()) a map(int,input().split()) map int input().split() ().split () input split b k r = gcd(a,b) r gcd(a,b) gcd a b e = [] e [] for i in range(1,r+1):
    if r%i == 0:
        e.append(i) i range(1,r+1) range 1 r+1 r 1 if r%i == 0:
        e.append(i) r%i == 0 r%i r i 0 e.append(i) e.append e append i print(e[len(e)-k]) print e[len(e)-k] e len(e)-k len(e) len e k a,b,k = map(int,input().split()) map(int,input().split()) a r = gcd(a,b) gcd(a,b) r k = map(int,input().split()) map(int,input().split()) k e = [] [] e b,k = map(int,input().split()) map(int,input().split()) b def gcd(a,b):
    if b == 0:
        return a
    else:
        return gcd(b,a%b) def gcd(a,b):
    if b == 0:
        return a
    else:
        return gcd(b,a%b) gcd
def gcd(a,b):
    if b == 0:
        return a
    else:
        return gcd(b,a%b)

a,b,k = map(int,input().split())
r = gcd(a,b)
e = []
for i in range(1,r+1):
    if r%i == 0:
        e.append(i)
print(e[len(e)-k])