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