// editor5
#include<stdio.h>
#include<stdlib.h>

typedef struct node{
    int data;
    struct node*next;
    struct node*prev;
}node;
node*head=NULL,*head1=NULL,*tail,*tail1;

void insertnode(int r){
    node*newnode=(node*)malloc(sizeof(node));
    newnode->data=r;
    newnode->next=NULL;
    newnode->prev=NULL;
    if(head==NULL){
        head=newnode;
        tail=newnode;
        head->next=head;
        head->prev=head;
    }
    else{
        newnode->next=head;
        newnode->prev=tail;
        head->prev=n
    }
}

void insertnode1(int r){
    node*newnode=(node*)malloc(sizeof(node));
    newnode->data=r;
    newnode->next=NULL;
    newnode->prev=NULL;
    if(head1==NULL){
        head1=newnode;
        tail1=newnode;
        head1->next=head1;
        head1->prev=head1;
    }
    else{
        
    }
}

void display(){
    node*temp=head,*temp1=head1;
    // do{
    //     printf("%d ",temp->data);
    //     temp=temp->next;
    // }while(temp!=head);
    // printf("\n");
    // do{
    //     printf("%d ",temp1->data);
    //     temp1=temp1->next;
    // }while(temp1!=head1);
}

int main(){
    int n,r;
    scanf("%d",&n);
    if(n<0){
        printf("Invalid input");
        return 0;
    }
    for(int i=0;i<n;i++){
        scanf("%d",&r);
        if(r<0){
            printf("Invalid input");
            return 0;
        }
        if(r%2==0){
            insertnode(r);
        }
        if(r%2==1){
            insertnode1(r);
        }
        display();
        return 0;
    }
}