main=readLn>>=putStrLn.unwords.map show.(\p->[quot((product(fst p))*(snd p))(4*(product(fst p))-(snd p)*(sum(fst p))),(fst p)!!0,(fst p)!!1]).(\m->[([n,w],m)|n<-[1..3500],w<-[1..3500],4*n*w-m*(n+w)>0,(mod(m*n*w)(4*n*w-m*(n+w)))==0]!!0)