a,b,k=map(int,input().split())
x=min(a,b)
l=[]
for i in range(1,x+1):
    if a%i==0 and b%i==0:
        l.append(i)
y=len(l)
print(l[y-k]) a,b,k=map(int,input().split()) a map(int,input().split()) map int input().split() ().split () input split b k x=min(a,b) x min(a,b) min a b l=[] l [] for i in range(1,x+1):
    if a%i==0 and b%i==0:
        l.append(i) i range(1,x+1) range 1 x+1 x 1 if a%i==0 and b%i==0:
        l.append(i) a%i==0 and b%i==0 a%i==0 a%i a i 0 b%i==0 b%i b i 0 l.append(i) l.append l append i y=len(l) y len(l) len l print(l[y-k]) print l[y-k] l y-k y k y=len(l) len(l) y l=[] [] l x=min(a,b) min(a,b) x a,b,k=map(int,input().split()) map(int,input().split()) a b,k=map(int,input().split()) map(int,input().split()) b k=map(int,input().split()) map(int,input().split()) k
a,b,k=map(int,input().split())
x=min(a,b)
l=[]
for i in range(1,x+1):
    if a%i==0 and b%i==0:
        l.append(i)
y=len(l)
print(l[y-k])