// editor4
#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->words[++s->top],word);
    return 1;
}
char* pop(struct Stack*s){
    if(s->top == -1)return NULL;
    return s->words[s->top--];
}
int main(){
    int n;
    char sentence[Max];
    struct stack s;
    
    
    scanf("%d",&n);
    getchar();
    fgets(sentence,Max,stdin);
    
    sentence[strcspn(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=top;i>=0;i--){
        printf("%s",stack[i]);
        if(i>0)printf(" ");
    }
    printf("\n");
    return 0;
}