// editor4
#include<stdio.h>
#include<stdlib.h>

typedef struct node{
    int data;
    struct node*next;
    struct node*prev;
}node;
node *head=NULL,*tail;

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{
        tail->next=newnode;
        newnode->prev=tail;
        tail=newnode;
        tail->next=head;
    }
}

void display(){
    node*temp=tail;
    do{
        printf("%d ",temp->data);
        temp=temp->prev;
    }while(temp!=tail);
}

int main(){
    int n,r,val;
    scanf("%d",&n);
    if(n<=0){
        printf("Invalid input");
        return 0;
    }
    for(int i=0;i<n;i++){
        scanf("%d",&r);
        insertnode(r);
    }
    scanf("%d",&val);
    insertnode(val);
    display();
    return 0;
}