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