#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
#include <iomanip>
using namespace std;

#define ll long long
#define ld long double


int main() {
	// your code goes here
	
	 ll n;
    cin>> n;
    stack<ll> sk;
    while(n--)
    {
        int op;
        cin>> op;

        if(op==1)
        {
            ll x;
            cin>> x;
            
            if(sk.empty())
                sk.push(x);
            else
                sk.push(max(x, sk.top()));

            cout<< sk.top() << "\n";

            
        }
        else 
        {
            if(!sk.empty())
                sk.pop();

            if(sk.empty())
                cout<< "Empty!\n";
            else
                cout<< sk.top() << "\n";
        }
    }
	return 0;
}