#include<stdio.h>
#include<stdlib.h>

typedef struct node{
    int data;
    struct node *next;
}node;

node *insert(node *head,int val){
    node *newnode=(node*)malloc(1*sizeof(node));
    newnode->data=val;
    if(head==NULL){
        newnode->next=newnode;
        return newnode;
    }
    newnode->next=head->next;
    head->next=newnode;
    return head;
}

void display(){
    node *i;
    for(i=head->next;i!=NULL;i=i->next){
        printf("%d ",i->data);
    }
    
}

int main(){
    int n;
    scanf("%d",&n);
    if(n<0){
        printf("Invalid input");
        return 0;
    }
    node *head=NULL;
    node *tail=NULL;
    for(int i=0;i<n;i++){
        int val;
        scanf("%d",&val);
        node *newnode=(node*)malloc(1*sizeof(node));
        newnode->data=val;
        if(head==NULL){
           newnode->next=newnode;
           head=newnode;
        }
        else{
            newnode->next=head->next;
            head->next=newnode;
            head=newnode;
        }
    }
    
    int v;
    scanf("%d",&v);
    head=insert(head,v);
    display(head);
    return 0;
}