// editor1
#include <iostream>
#include <cctype>
using namespace std;

struct Node {
    string task;
    Node* next;
    Node* prev;
    Node(string val) : task(val), next(nullptr), prev(nullptr) {}
};

void deleteFirst(Node*& head) {
    if (!head) return;
    Node* temp = head;
    head = head->next;
    if (head) head->prev = nullptr;
    delete temp;
}

void printList(Node* head) {
    if (!head) {
        cout << "List is empty\n";
        return;
    }
    Node* temp = head;
    while (temp) {
        cout << temp->task;
        if (temp->next) cout << " ";
        temp = temp->next;
    }
    cout << "\n";
}

int main() {
    int n;
    if (!(cin >> n) || n < 1 || n > 1000) {
        cout << "Invalid input\n";
        return 0;
    }

    Node* head = nullptr;
    Node* tail = nullptr;

    for (int i = 0; i < n; i++) {
        string task;
        if (!(cin >> task)) {
            cout << "Invalid input\n";
            return 0;
        }

        // check if first character is a digit
        if (isdigit(task[0])) {
            cout << "Invalid input\n";
            return 0;
        }

        Node* newNode = new Node(task);
        if (!head) {
            head = tail = newNode;
        } else {
            tail->next = newNode;
            newNode->prev = tail;  // maintaining reverse linkage
            tail = newNode;
        }
    }

    // delete first task
    deleteFirst(head);

    // print updated list
    printList(head);

    // free memory
    while (head) {
        Node* temp = head;
        head = head->next;
        delete temp;
    }

    return 0;
}