// editor2
#include<stdio.h>
#include<stdlib.h>
struct node{
    int data;
    struct node* next;
};

struct node* head=NULL;
struct node* temp;

void createlist(){
    temp=head;
    struct node* newnode=(struct node*)malloc(sizeof(struct node));
    scanf("%d",&newnode->data);
    newnode->next=NULL;
    if(head==NULL){
        head=temp=newnode;
    }
    else
    {
        temp->next=newnode;
        temp=newnode;
    }

}
void printlist(){
    temp=head;
    while(temp!=NULL){
        temp=temp->next;
    }
    
}
void insertAtPosition(){
    int count=0;
    temp=head;
    while(temp!=NULL){
        temp=temp->next;
        count++;
    }
    i=1;
    while(i<count/2){
        temp=temp->next;
        i++;
    }
    struct node* newnode=(struct node*)malloc(sizeof(struct node));
    newnode->data=val;
    newnode->next=temp->next;
    temp->next=newnode;
    printlist();
}
int main(){
    int n;
    scanf("%d",&n);
    for(int i=0;i<n;i++){
        createlist();
    }
    int val;
    scanf("%d",&val);
    insertAtPosition(int val);
}