//栈的数组实现
#include <cstdio>
#include <cstdlib>
//#define _OJ_
#define stack_size 100
typedef struct Lnode
{
int base;
int top;
int *elem;
} Lnode, *stack;
stack
creat_list(stack s)
{
s = (stack) malloc (sizeof(Lnode));
s->elem = (int*) malloc (stack_size * sizeof(int));
s->top = s->base = -1;
return s;
}
int
isEmpty(stack s)
{
if(s->top == s->pop)
return 1;
else
return 0;
}
void
push(stack s,int x)
{
if(!isEmpty(s))
s->elem[++s->top] = x;
}
int
pop(stack s)
{
if(!isEmpty(s))
int e;
e = s->elem[s->top--];
return e;
}
int main(int argc, char const *argv[]) {
#ifndef _OJ_ //ONLINE_JUDGE
freopen("input.txt", "r", stdin);
#endif
int i, n, x;
stack s;
s = creat_list(s);
scanf("%d", &n);
for(i = 0;i < n; i++) {
scanf("%d", &x);
push(s,x);
}
for(i = 0;i < n; i++) {
printf("%d
", pop(s));
}
return 0;
}