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

a,b,k=map(int,input().split())
g=gcd(a,b)
cnt=0
for i in range(g,0,-1):
    if g%i==0: cnt+=1
    if cnt==k:
        print(i)
        break def gcd(a,b):
    if b==0: return a
    return gcd(b,a%b) gcd if b==0: return a
     b==0 b 0 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 g=gcd(a,b) g gcd(a,b) gcd a b cnt=0 cnt 0 for i in range(g,0,-1):
    if g%i==0: cnt+=1
    if cnt==k:
        print(i)
        break i range(g,0,-1) range g 0 -1 if g%i==0: cnt+=1
     g%i==0 g%i g i 0 if cnt==k:
        print(i)
        break cnt==k cnt k print(i) print i break def gcd(a,b):
    if b==0: return a
    return gcd(b,a%b) def gcd(a,b):
    if b==0: return a
    return gcd(b,a%b) gcd cnt=0 0 cnt g=gcd(a,b) gcd(a,b) g k=map(int,input().split()) map(int,input().split()) k a,b,k=map(int,input().split()) map(int,input().split()) a b,k=map(int,input().split()) map(int,input().split()) b
def gcd(a,b):
    if b==0: return a
    return gcd(b,a%b)

a,b,k=map(int,input().split())
g=gcd(a,b)
cnt=0
for i in range(g,0,-1):
    if g%i==0: cnt+=1
    if cnt==k:
        print(i)
        break