#include<stdio.h>
#include<string.h>
int main(){
    int n;
    char sentence[101];
    char stack[20][101];
    int top=-1;
    scanf("%d",&n);
    if(n<0){
        printf("Invalid input");
        return 0;
    }
    scanf(" %[^\n]",sentence);
    char *token=strtok(sentence," ");
}
while(top>=0){
    printf("%s",stack[top--]);
    if(top>=0)
    printf(" ");
 }
 return 0;
}