#include<stdio.h>
#include<string.h>
int main(){
    int n;
    char sentence[101];
    scanf("%d",&n);

    if(n<0){
        printf("Invalid input");
        return 0;
    }
    getchar();
    if(fgets(sentence,sizeof(sentence),stdin)==NULL){
        printf("Invalid input");
        return 0;
    }
    sentence[strcspn,(sentence,"\n")]='\0';

    char *stack[100];
    int top=-1;
    char*word=strtok(sentence," ");
    while(word!=NULL){
        stack[++top]=word;
        word=strtok(NULL," ");
    }
    for(int i=top;i>=0;i++){
        printf("%s",stack[i]);
        if(i>0)printf(" ");
    }
    return 0;
}