#include <stdio.h>
#include <stdlib.h>
#include <string.h>

struct Node {
    char data[50];
    struct Node *next;
};

// Function to create a new node
struct Node* createNode(char *value) {
    struct Node newNode = (struct Node)malloc(sizeof(struct Node));
    strcpy(newNode->data, value);
    newNode->next = NULL;
    return newNode;
}

// Function to print circular list
void printCircular(struct Node *head) {
    if (head == NULL) return;
    struct Node *temp = head;
    do {
        printf("%s", temp->data);
        temp = temp->next;
        if (temp != head) printf(" ");
    } while (temp != head);
}

int main() {
    int n;
    scanf("%d", &n);

    if (n < 1 || n > 100) {
        printf("Invalid input");
        return 0;
    }

    struct Node *head = NULL, *tail = NULL;
    int count = 0;

    // Read n strings
    for (int i = 0; i < n; i++) {
        char str[50];
        if (scanf("%s", str) != 1) {
            printf("Invalid input");
            return 0;
        }
        struct Node *newNode = createNode(str);

        if (head == NULL) {
            head = tail = newNode;
        } else {
            tail->next = newNode;
            tail = newNode;
        }
        count++;
    }

    // If inputs don't match n
    if (count != n) {
        printf("Invalid input");
        return 0;
    }

    // Make circular
    tail->next = head;

    // Read new string to insert
    char newStr[50];
    if (scanf("%s", newStr) != 1) {
        printf("Invalid input");
        return 0;
    }

    // Create new node
    struct Node *newNode = createNode(newStr);

    // Find middle index
    int mid = n / 2;

    // Traverse to middle
    struct Node *temp = head;
    for (int i = 0; i < mid - 1; i++) {
        temp = temp->next;
    }

    // Insert newNode
    newNode->next = temp->next;
    temp->next = newNode;

    // If inserted at end, update tail
    if (mid == n) {
        tail = newNode;
    }
    tail->next = head;

    // Print result
    printCircular(head);

    return 0;
}