// editor1
#include<stdio.h>
#include<string.h>
#define max 100
int stack[100];
int top =-1;
int size = max;
void push(int x,int size){
    if(top==size -1){
        printf("Stack overflow");
        return;
    }
    stack[++top]=x
}
void pop(){
    if(top == 1){
        print("Stack underflow");
        return;
    }
    top --;
}
void display(){
    if(top == -1){
        printf("Stack underflow");
    }
    for (int i = 0;i<=top ; i++){
        printf("%d",stack[i]);
    }
}
void peek(){
    if(top == -1){
        printf("Stack underflow");
        return;
    }
    printf("%d\n",stack[top]);
    printf("\n");
}
int main(){
    int n;
    char str[20];
    scanf("%d ,&n");
    if(n<0){
        printf("Invalid input");
        return 0;
    }
    
    for(int i=0;i<size;i++){
        scanf("%s",str){
        if(strcmp("PUSH")==0){
            int x;
            scanf("%d",&x);
            push(x,size);
        }
        else if(strcmp(str,"POP")==0){
            pop();
            
        }
        else if(strcmp(str,"PEEK")==0){
            printf("\n");
            peek();
        
    }
    else if(strcmp(str,"DISPLAY")==0){
            display();
}
else {
    printf("Invalid input");
    return 0;
}
}
return 0;
}