main = interact $ unlines . map (show . coconut_grab . read) . init . lines

coconut_grab e = head cand
 where cand = [x+y+z | let r3e = (ceiling.cbrt.fromIntegral) e,
                       let r2e = (ceiling.sqrt.fromIntegral) e,
                       x<-[0..r3e], y<-[0..r2e], z<-[0..r3e], x + y^2 + z^3 == e]
                       
cbrt q = until approx (\q' -> q' - (q'^3-q) / (3*q'^2)) (q/2)
 where approx x = abs (x^3 - q) < 0.00001*q