// editor2
#include<stdio.h>
#include<string.h>
typedef struct node{
    char word[20];
    struct node*next;
}node;
node*top=NULL;
void push(char*str){
    node*newnode=(node*)malloc(sizeof(node));
    strcpy(newnode->word,str);
    newnode->next=top;
    top=newnode;
}
void popall(){
    while(top!=NULL){
        printf("%s",top->word);
        node*temp=top;
        top=top->next;
        free(temp);
    }
    printf("\n");
}
int main(){
    int n;
    scanf("%d",&n);
    if(n<0){
    printf("Invalid input");
    return 0;
    }
    char sent[101];
    while(getchar()!='\n');
    fgets(sent,sizeof(sent),stdin);
    char*word=strtok(sent,"\n\t");
    int count =0;
    while(word!=NULL && count<n){
        push(word);
        word=strtok(NULL,"\n\t");
        count++;
    }
    popall();
    return 0;
}