uses crt;
const n=6;
TYPE mas=array[1..n] of integer;
procedure bubble(var x:mas);
var i,j,T:integer;
begin
for i:=1 to n do
for j:=n downto i+1 do
if (x[i]<0{первый} ) and (x[j]<0{второй}) and (x[i]<x[j]{третий}) then
begin
T:=x[i];
x[i]:=x[j];
x[j]:=T;
end;
end;
var i:byte; x:mas;
begin
clrscr;
writeln('Enter array ',n);
for i:=1 to n do
readln(x[i]);
clrscr;
for i:=1 to n do
write(x[i],' ');
bubble(x);
writeln;
for i:=1 to n do
write(x[i],' ');
readln;
end.