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