#include<stdio.h>
 #include<stdlib.h>
 typedef struct node{
     int data;
     struct node *next;
 }Node;
 Node *head=NULL;
 void insert(int num){
     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!=temp->next);
 }
 int main(){
     int size,num;
     scanf("%d",&size);
     for(int i=1;i<=size;i++){
         scanf("%d",&num);
         insert(num);
     }
     int val;
     scanf("%d",&val);
     insert(val);
     display();
     return 0;
 }