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

coconut_grab e = head cand
 where cand = [x+y+z | let e' = (floor.sqrt.fromIntegral) e,
                       x<-[0..e'], y<-[0..e-x], z<-[0..e-x-y^2], x + y^2 + z^3 == e]