#include<stdio.h>
#include<string.h>
#define MAX 100
struct stack{
    char word[10][MAX];
    int top;
};
void initStack(struct stack*s){
    s->top=-1;
}
int push(struct stack*s, char*word, int n){
    if(s->top+1 >= n)return 0;
    strcpy(s->word[++s -> top], word);
    return 1;
}
char* pop(struct stack*s){
    if(s->top == -1)return NULL;
    return s->word[s->top--];
}
int main(){
    int n;
    char sentence[MAX];
    struct stack s;
    scanf("%d", &n);
    scanf(" %[^\n", sentence, "\n")] = '\0';
    if(n<0){
        printf("Invalid input\n");
        return 0;
    }
    initStack(&s);
    char *word=strtok(sentence, " ");
    while(word!=NULL){
        push(&s,word,n);
        word=strtok(NULL," ");
    }
    for(int i=s.top;i>=0;i--){
        printf("%s ",s.word[i]);
        if(i<0)printf(" ");
    }
    printf("\n");
    return 0;
}