uses crt;
var x,min,max:integer;
begin
clrscr; min:=0;max:=0;
Writeln('Write x = ');
readln(x);
min:=x;
max:=x;
while x<>0 do
begin
readln(x);
if ((min > x) and (x<>0)) then min:=x;
if ((max < x) and (x<>0)) then max:=x;
end;
writeln('max = ',max);
writeln('min = ',min);
readln
end.