var a : array [1..10] of integer;
i, max,min,nmax,nmin: integer;
begin
randomize;
for i:= 1 to 10 do
begin
a[i] := random(50);
write (a[i], ' ');
end;
writeln;
max:=a[1];
min:=a[1];
for i:= 1 to 10 do
begin
if a[i]>max then begin max:=a[i];nmax:=i;end;
if a[i]
end;
a[nmax]:=a[10];a[10]:=max;
a[nmin]:=a[1];a[1]:=min;
for i:= 1 to 10 do
begin
write (a[i], ' ');
end;
end.