using System;
public class Program
{
public static void Main()
int n,aux,i;
int []v;
n = int.Parse(Console.ReadLine());
v=new int[n+1];
for( i=0;i<n;i++)
v[i]=int.Parse(Console.ReadLine());
}
int x=0,y=n-1;
while(x<y)
if(v[x]%2==0)x++;
if(v[y]%2!=0)y--;
if(v[x]%2!=0 && v[y]%2==0)
aux=v[x];
v[x]=v[y];
v[y]=aux;
else
if(v[x]%2!=0)y--;
else if(v[y]%2==0)x++;
for( i=0;i<n;i++)Console.Write(v[i]+" ");