#include <stdio.h>
#include <string.h>
#define max 100
#define strlen 100
char stack[max][strlen];
int top=-1;
void push(char *val){
    if(top==max-1){
        printf("Stack Overflow\n");
        return;
    }
    top++;
    strcpy(stack[top],val);
}
void display(){
    if(top==-1){
        printf("Stack Underflow\n");
        return ;
    }
    for(int i=top;i>=0;i--){
       printf("%s",stack[i]);
       if(i>0) printf(" ")
    }
    printf("\n");
}
void pop(){
    if(top==-1){
        printf("Stack Underflow\n");
        return;
    }
    top--;
}
void peek(){
    if(top==-1){
        printf("Stack Underflow\n");
        return;
    }
    printf("%s\n",stack[top]);
}   
int main(){
    int n;
    scanf("%d",&n);
    if(n<0){
        printf("Invalid input");
        return 0;
    }
    char a[strlen];
    int val;
    for(int i=0;i<n;i++){
        scanf("%s",a);
        push(a);
    }
    display();
    return 0;
}