a,b,k=map(int,input().split())
m=max(a,b)
i=0
while i<k:
    if a%m==0 and b%m==0:
        i+=1
    m-=1
print(m+1) a,b,k=map(int,input().split()) a map(int,input().split()) map int input().split() ().split () input split b k m=max(a,b) m max(a,b) max a b i=0 i 0 while i<k:
    if a%m==0 and b%m==0:
        i+=1
    m-=1 i<k i k if a%m==0 and b%m==0:
        i+=1
     a%m==0 and b%m==0 a%m==0 a%m a m 0 b%m==0 b%m b m 0 i+=1 i 1 m-=1 m 1 print(m+1) print m+1 m 1 a,b,k=map(int,input().split()) map(int,input().split()) a b,k=map(int,input().split()) map(int,input().split()) b m=max(a,b) max(a,b) m m-=1 1 m i=0 0 i k=map(int,input().split()) map(int,input().split()) k i+=1 1 i
a,b,k=map(int,input().split())
m=max(a,b)
i=0
while i<k:
    if a%m==0 and b%m==0:
        i+=1
    m-=1
print(m+1)