Var
Y, Z: array[1..10000] of integer;
n, i, k: integer;
Begin
Write('n = ');ReadLn(n);
For i := 1 to n do
Begin
Write('Y[',i,'] = ');ReadLn(Y[i]);
End;
k := 0;
For i:= 1 to n do
if (Y[i] < 0) then
Begin
k := k+1;
Z[k] := Y[i];
End;
For i:= 1 to n do
if (Y[i] > 0) then
Begin
k := k+1;
Z[k] := Y[i];
End;
For i:= 1 to n do
if (Y[i] = 0) then
Begin
k := k+1;
Z[k] := Y[i];
End;
Write('Y:');
For i:= 1 to n do
Write(' ',Y[i]);
WriteLn;
Write('Z:');
For i:= 1 to n do
Write(' ',Z[i]);
End.