var a:array[1..10]of integer;
i,j,k:integer;
begin
for i:=1 to 10 do a[i]:=random(101);
for i:=1 to 10 do write(a[i],' ');
writeln;
for i:=1 to 5 do
for j:=1 to 4 do
if a[j]>a[j+1] then begin
k:=a[j];
a[j]:=a[j+1];
a[j+1]:=k;
end;
for i:=1 to 5 do
for j:=7 to 10 do
if a[j]>a[j-1] then begin
k:=a[j];
a[j]:=a[j-1];
a[j-1]:=k;
end;
for i:=1 to 10 do write(a[i],' ');
end.