// editor1
#include<stdio.h>
#include<stdlib.h>
#define MAX 1000
struct stack {
    int arr[MAX];
    int top;
};
void inistack(struct stack*s) {
    s->top=-1;
}
void push(struct stack*s,int value) {
    if(s->top==MAX-1_) {
        printf("Stack Overflow\n");
        return;
    }
    s->arr[++(s->top)]=value;
}
void display(struct Stack*s) {
    for(int i=0;i<=s->top;i++) {
        printf("%d",s->arr[i]);
        if(i<s->top)print(" ");
}
printf("\n");
}
int main() {
    int n;
    struct Stack s;
    iniStack(&s);
    if(scanf("%d",&n)!=1 || n<0) {
        printf("Invalid input\n");
        return 0;
    }
    for(int i=0;i<n;i++) {
        int val;
        scanf("%d",&val);
        push(&s,val);
}
display(&s);
return 0;
}