Var n,d,a,h,o,max:integer; begin readln(n); d:=n div 1000; h:=(n mod 1000) div 100; a:= n mod 100 div 10 ; o:=n mod 10; If (d>h) and (d>a) and (d>o) then max:=d; If (h>d) and (h>a) and (h>o) then max:=h; If (a>d) and (h<a) and (a>o) then max:=a; If (o>d) and (h<o) and (a<o) then max:=o; If d=max then writeln(0,h,a,o); If h=max then writeln(d,0,a,o); If a=max then writeln(d,h,0,o); If o=max then writeln(d,h,a,0); end.
begin
readln(n);
d:=n div 1000;
h:=(n mod 1000) div 100;
a:= n mod 100 div 10 ;
o:=n mod 10;
If (d>h) and (d>a) and (d>o) then max:=d;
If (h>d) and (h>a) and (h>o) then max:=h;
If (a>d) and (h<a) and (a>o) then max:=a;
If (o>d) and (h<o) and (a<o) then max:=o;
If d=max then writeln(0,h,a,o);
If h=max then writeln(d,0,a,o);
If a=max then writeln(d,h,0,o);
If o=max then writeln(d,h,a,0);
end.