program brainly;
type vector=array[0..100] of integer;
var
aux:integer;
v:vector;
i, j, n:integer;
procedure citireX();
begin
writeln ('Dati numarul de elemente n:'); read(n);
for i:=0 to n-1 do begin
readln(v[i]);
end;
end;
procedure afisareX(n:integer);
begin
writeln();
writeln('Sirul x:');
for i:=0 to n-1 do begin
write(' ',v[i]);
end;
end;
procedure ordCresc(n:integer);
begin
for i:=0 to n-1 do begin
for j:=0 to n-1 do begin
if (v[i] < v[j]) AND (i mod 2 <> 0) AND (j mod 2 <> 0) then
begin
aux:=v[i];
v[i]:=v[j];
v[j]:=aux;
end;
end;
end;
end;
procedure ordDesc(n:integer);
begin
for i:=0 to n-1 do begin
for j:=0 to n-1 do begin
if (v[i] > v[j]) AND (i mod 2 = 0) AND (j mod 2 = 0) then
begin
aux:=v[i];
v[i]:=v[j];
v[j]:=aux;
end;
end;
end;
end;
begin
citireX();
afisareX(n);
ordCresc(n);
ordDesc(n);
afisareX(n);
end.