#include<stdio.h>
#include<string.h>
int main()
{
    int stack[100], top=-1;
    int q,x;
    char cmd[20];
    scanf("%d",&q);
    if(q<0)
    {
        printf("Invalid input");
        return 0;
        
    }
    while(q--)
    {
        scanf("%s",cmd);
        if(strcmp(cmd,"PUSH")==0)
        {
            scanf("%d",&x);
            scanf[++top]=x;
        }
        else if(strcmp(cmd,"POP")==0)
    }
    if(top==-1)
    printf("Stack under flow\n");
    else
    top--;
}
else if(strcmp(cmd,"DISPLAY")==0)
{
    for(int i=0;i<=top;i++)
    printf("%d ",stack[i]);
    printf("\n");
}
}
return 0;