#include
using namespace std;
class node{
public:
int data;
node * next;
node(int d){
data = d;
next = NULL;
}
};
void insertAtTail(node * &head,int data){
if(head == NULL){
head = new node(data);
return;
}
node * temp = head;
while(temp->next != NULL){
temp = temp->next;
}
temp->next = new node(data);
}
void print(node * head){
if(head == NULL){
return;
}
while(head){
cout<data<<" ";
head = head->next;
}
}
node * evenOdd(node * &head){
if(head == NULL || head->next == NULL){
return head;
}
node *t1=head;
node *t2=head;
while(t2){
if((t2->data)%2==0){
t2=t2->next;
}
else{
swap(t1->data,t2->data);
t1=t1->next;
t2=t2->next;
}
}
return head;
}
int main() {
node * head = NULL;
int l1;
cin>>l1;
int data;
for(int i=0;i<l1;i++){
cin>>data;
insertAtTail(head,data);
}
evenOdd(head);
print(head);
return 0;
}