#include <stdio.h>
#include <stdlib.h>
#define MAX_SIZE 100
int stack[MAX_SIZE];
int top=-1,count=0;
void push(int x, int y)
{
if (count+2 <= MAX_SIZE )
{
stack[++top] = x;
count++;
stack[++top] = y;
count++;
printf("Pushed\n");
} else {
printf("Overflow\n");
}
}
void pop() {
if (top < 1) {
printf("Underflow\n");
} else {
int x = stack[top--];
int y = stack[top--];
if (top < MAX_SIZE - 1) {
stack[++top] = y;
}
}
}
void top_element()
{
if (top== -1) {
printf("Empty\n");
} else {
printf("%d\n", stack[top]);
}
}
int main() {
stack;
top = -1;
int n;
scanf("%d", &n);
for (int i = 0; i < n; i++) {
int command;
scanf("%d", &command);
if (command == 1) {
int x, y;
scanf("%d %d", &x, &y);
push( x, y);
} else if (command == 2) {
pop();
} else if (command == 3) {
top_element();
}
}
return 0;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CiNpbmNsdWRlIDxzdGRsaWIuaD4KCiNkZWZpbmUgTUFYX1NJWkUgMTAwCgoKICAgIGludCBzdGFja1tNQVhfU0laRV07CiAgICBpbnQgdG9wPS0xLGNvdW50PTA7Cgp2b2lkIHB1c2goaW50IHgsIGludCB5KQogewogICAgaWYgKGNvdW50KzIgPD0gTUFYX1NJWkUgKQogewogICAgICAgIHN0YWNrWysrdG9wXSA9IHg7CmNvdW50Kys7CiAgICAgICAgc3RhY2tbKyt0b3BdID0geTsKY291bnQrKzsKICAgICAgICBwcmludGYoIlB1c2hlZFxuIik7CiAgICB9IGVsc2UgewogICAgICAgIHByaW50ZigiT3ZlcmZsb3dcbiIpOwogICAgfQp9Cgp2b2lkIHBvcCgpIHsKICAgIGlmICh0b3AgPCAxKSB7CiAgICAgICAgcHJpbnRmKCJVbmRlcmZsb3dcbiIpOwogICAgfSBlbHNlIHsKICAgICAgICBpbnQgeCA9IHN0YWNrW3RvcC0tXTsKICAgICAgICBpbnQgeSA9IHN0YWNrW3RvcC0tXTsKICAgICAgICBpZiAodG9wIDwgTUFYX1NJWkUgLSAxKSB7CiAgICAgICAgICAgIHN0YWNrWysrdG9wXSA9IHk7CiAgICAgICAgfQogICAgfQp9Cgp2b2lkIHRvcF9lbGVtZW50KCkKewogICAgaWYgKHRvcD09IC0xKSB7CiAgICAgICAgcHJpbnRmKCJFbXB0eVxuIik7CiAgICB9IGVsc2UgewogICAgICAgIHByaW50ZigiJWRcbiIsIHN0YWNrW3RvcF0pOwogICAgfQp9CgppbnQgbWFpbigpIHsKICAgc3RhY2s7CiAgICB0b3AgPSAtMTsKCiAgICBpbnQgbjsKICAgIHNjYW5mKCIlZCIsICZuKTsKCiAgICBmb3IgKGludCBpID0gMDsgaSA8IG47IGkrKykgewogICAgICAgIGludCBjb21tYW5kOwogICAgICAgIHNjYW5mKCIlZCIsICZjb21tYW5kKTsKCiAgICAgICAgaWYgKGNvbW1hbmQgPT0gMSkgewogICAgICAgICAgICBpbnQgeCwgeTsKICAgICAgICAgICAgc2NhbmYoIiVkICVkIiwgJngsICZ5KTsKICAgICAgICAgICAgcHVzaCggeCwgeSk7CiAgICAgICAgfSBlbHNlIGlmIChjb21tYW5kID09IDIpIHsKICAgICAgICAgICAgcG9wKCk7CiAgICAgICAgfSBlbHNlIGlmIChjb21tYW5kID09IDMpIHsKICAgICAgICAgICAgdG9wX2VsZW1lbnQoKTsKICAgICAgICB9CiAgICB9CgogICAgcmV0dXJuIDA7Cn0=