a,b,k=map(int,input().split())
p=[]
for i in range(1,a+1):
  if a%i==0 and b%i==0:
    p.append(i)

n=len(p)
print(p[n-k]) a,b,k=map(int,input().split()) a map(int,input().split()) map int input().split() ().split () input split b k p=[] p [] for i in range(1,a+1):
  if a%i==0 and b%i==0:
    p.append(i) i range(1,a+1) range 1 a+1 a 1 if a%i==0 and b%i==0:
    p.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 p.append(i) p.append p append i n=len(p) n len(p) len p print(p[n-k]) print p[n-k] p n-k n k a,b,k=map(int,input().split()) map(int,input().split()) a b,k=map(int,input().split()) map(int,input().split()) b n=len(p) len(p) n k=map(int,input().split()) map(int,input().split()) k p=[] [] p
a,b,k=map(int,input().split())
p=[]
for i in range(1,a+1):
  if a%i==0 and b%i==0:
    p.append(i)

n=len(p)
print(p[n-k])