// editor1
#include<string.h>
#include<string.h>
#define MAX 5
int stack[MAX];
int top =-1;
void push(int x);{
if(top>= MAX -1){
    printf("stack is full");
    
}
else{
    stack[++top];
}
void push(){
if(top== -1){
    printf("stack is empty");
    
}
else{
    printf("%d",stack[top]);
}
}
int main(){
   
   int n;
scanf("%d",&n);
for(int i=0;i<n;i++)
char cmd[10]
scanf("%d",&cmd)
if(strcmd (cmd,"push")==0){
    int x;
    scanf("%d",&x);
    push(x);
    
}
else if(strcmd (cmd,"push")==0)
peek(x);
 
}