#include<stdio.h>
#include<stdlib.h>
struct Node{
    int data;
    struct Node* next;
};
struct Node*createNode(int value){
    struct Node*newNode=(struct Node*)malloc(sizeof(struct Node));
    newNode->data=value;
    newNode->next=NULL;
    return newNode;
}
void printList(struct Node* head){
    struct Node* temp=head;
    while(temp!=NULL){
        printf("%d ",temp->data);
        temp=temp->next;
    }
    printf("\n");
}
int main(){
    int n;
    if(scanf("%d",&n)!=1){
        printf("Invalid input\n");
        return 0;
    }
    struct Node* head=NULL;
    struct Node* tail=NULL;
    for(int i=0;i<n;i++){
        int value;
        if(scanf("%d",&value)!=1){
            printf("Invalid input\n");
            return 0;
        }
        struct Node* newNode=createNode(value);
        if(head==NULL){
            head=tail=newNode;
        }else{
            tail->next=newNode;
            tail=newNode;
        }
    }
    int newVal;
    if(scanf("%d",&newVal)!=1){
        printf("Invalid input\n");
        return 0;
    }
    struct Node* newNode=createNode(newVal);
    if(head==NULL){
        head=newNode;
        printList(head);
        return 0;
    }
    int pos=(n%2==0)?(n/2):(n/2);
    struct Node* temp=head;
    for(int i=1;i<pos;i++){
        temp->next=newNode;
    }
    newNode->next=temp->next;
    temp->next=newNode;
    printList(head);
    return 0;
}