#include <bits/stdc++.h>
#define mp make_pair
using namespace std ;
const int NR = 100005 ;
vector < int > st ;
//ifstream in ("date.in") ;
int main () {
    int sw , type , n , val ;
    cin >> n ;
    vector < int > :: iterator it ;
    while ( n -- )  {
    cin >> type ;
        if ( type == 1 )    {
            cin >> val ;
            st.push_back( val ) ;
        }
        if ( type == 2 )    {
            st.pop_back() ;
        }
        if ( type == 3 )    {
            cin >> val ;
            sw = 0 ;
            for ( it = st.begin() ; it != st.end() ; ++ it )    {
                if ( *it <= val )   cout << *it << ' ' , sw = 1 ;
            }
            if ( !sw )  cout << "Empty\n" ;
            else        cout << "\n" ;
        }
    }
}