import math
a,b,k = map(int,input().split())

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

g = math.gcd(a,b)
c = 0
i = 1
for i in range(g,0,-1) :
    if g%i == 0 :
        c+=1
        if c==k :
            break
print(i)     
    
