Program hotrotinhoc;
var a,b,d,c : integer;
begin
d:=0;
for a:=1 to 9 do
for b:= 0 to 9 do
for c:=0 to 9 do
if (a*100)+(b*10)+c = (a*a*a)+(b*b*b)+(c*c*c) then
begin
writeln(a,' ',b,' ',c);
inc(d);
end;
if d=0 then write('0');
readln
end.