#include
using namespace std;
struct node{
long long int data;
struct node *next;
};
struct node *p,*s;
void addtrail(node &head,long long int data){
noden=new node;
n->data=data;
n->next=NULL;
if(head==NULL){
head=n;
p=n;
}
p->next=n;
p=n;
}
void kalternate(node *&head,node &head1){
node cur=head;
while(cur){
int u=cur->data;
if(((u)%2!=0)&&(head1==NULL)){
head1=cur;
s=head1;
cout<data;
}
if(((u)%2!=0)&&(head1!=NULL)){
s->next=cur;
s=cur;
}
cur=cur->next;
}
node *w=head;
while(w){
int v=w->data;
if(((v)%2==0)&&(head1==NULL)){
head1=w;
s=head1;
}
if(((v)%2==0)&&(head1!=NULL)){
s->next=w;
s=w;
}
w=w->next;
}
s->next=NULL;
}
int main() {
long long int n,k;
cin>>n;
long long int a[n];
node *head=NULL;
for(long long int i=0;i<n;i++){
cin>>a[i];
addtrail(head,a[i]);
}
node* head1=NULL;
kalternate(head,head1);
node *u=head1;
while(u){
cout<data<<" ";
u=u->next;
}
return 0;
}