#include<stdio.h>
#include<stdlib.h>
#include<string.h>
typedef struct Node{
    char task[101];
    struct Node*prev;
    struct Node*next;
}Node;
void printList(Node*head){
    Node*current=head;
    while(current!=NULL){
        printf("%s",current->task);
        if(current->next!=NULL)
        printf(" ");
        current=current->next;
    }
}
void freeList(Node*head){
    Node*current= head;
    while(current!=NULL){
        Node*temp=current;
        current=current->next;
        free(temp);
    }
}
int main(){
    int n;
    scanf("%d",&n);
    Node*head=NULL,*tail=NULL;
    for (int i=0;i<n;i++){
        char temp[101];
        scanf("%s",&temp);
        Node*newNode=(Node*)malloc(sizeof(Node));
        strcpy(newNode->task,temp);
        newNode->prev=tail;
        newNode->next=NULL;
        if(tail!=NULL){
           tail->next=newNode; 
        }else{
            head=newNode;
        }
        tail=newNode;
    }
    if(head!=NULL){
        Node*toDelete=head;
        head=head->next;
        if(head!=NULL){
            head->prev=NULL;
        }else{
            tail=NULL;
        }
        free(toDelete);
        }
        printList(head);
        freeList(head);
        return 0;
    }