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