const n=10;
var A : Array [1..10] of integer;
i, mini, maxi, min,max, c,k: integer;
begin
for i := 1 to n do
begin
A[i] := random(10);
write(' ',A[i]);
end;
maxi:=1;
mini:=1;
For i:=1 to n do
begin
min:=A[1];
If A[i]>max then
begin
max:=A[i];
maxi:=i;
end;
If A[i] begin
min:=A[i];
mini:=i;
end;
c:=A[maxi];
A[maxi]:=A[mini];
A[mini]:=c;
end;
Writeln;
for i:=1 to n do
begin
Write(' ',a[i]);
end;
Writeln;
for i:=1 to n do
begin
If a[i]>4 then
begin
a[i]:=4;
inc(k);
end;
Write(' ',a[i]