var a:array[1..10]of integer; b,min,max,I,maxi,mini:integer; begin for I :1 to 10 do readln(a[I]); max:=a[1]; min:=a[1]; maxi:=1; mini:=1; for I :1 to 10 do begin if a[I]>max then begin max:=a[I]; maxi:=I; end; if a[I]<min then begin min:=a[I]; mini:=I; end; a[maxi]:=min; a[mini]:=max; for I :1 to 10 do writeln(a[I]); end.
a:array[1..10]of integer;
b,min,max,I,maxi,mini:integer;
begin
for I :1 to 10 do
readln(a[I]);
max:=a[1];
min:=a[1];
maxi:=1;
mini:=1;
for I :1 to 10 do
begin
if a[I]>max then begin
max:=a[I];
maxi:=I;
end;
if a[I]<min then begin
min:=a[I];
mini:=I;
end;
a[maxi]:=min;
a[mini]:=max;
for I :1 to 10 do
writeln(a[I]);
end.