Var
a,b,c,d:array[1..100]of integer;
i,n,n2,k,k2:integer;
begin
readln(n);
k:=0;
k2:=0;
for i:=1 to n do begin
read(a[i]);
if a[i]>0 then begin
inc(k);
c[k]:=a[i];
end;
if a[i] mod 2=0 then begin
inc(k2);
d[k2]:=a[i];
end;
end;
readln(n2);
for i:=1 to n2 do begin
read(b[i]);
if b[i]>0 then begin
inc(k);
c[k]:=b[i];
end;
if b[i] mod 2=0 then begin
inc(k2);
d[k2]:=b[i];
end;
end;
writeln;
for i:=1 to k do write(c[i],' ');
writeln;
for i:=1 to k2 do write(d[i],' ');
end.