#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#define max 5
int stack [max];
int top=-1;
int isfull()
{
    return top==max-1;
}
int isempty()
{
    return top==-1;
}
void push(int data) {
   if(!isFull()){
      stack[top] = data;
   } else {
      printf("Cannot add data. Stack is full.\n");
   }      
}
void peek()
{
    if(isempty())
    {
        printf("the stack is empty\n");
    }
    else
    {
        printf("%d\n",stack[top]);
    }
}
int main()
{
    int n,data;
    char command[10];
    scanf("%d",&n);
    for(int i=o;i<n;i++)
    {
        scanf("%s".&command);
        if(strcmp(command,"push")==0)
        {
            scanf("%d",&data);
            push(data);
        }
        else if(strcmp(command,"peek")==0)
        {
           peek(); 
        }
    }
    return 0;
}