#include	<vector>
#include	<iostream>
#include	<fstream>
#include	<iterator>
#include	<algorithm>

using namespace std;

vector < int > V ;

int main(){
//    freopen("a.in","r",stdin) ;


    int n ;
    cin >> n ;
    int o ,x ;

    while (n--){
            cin >> o;

    if ( o == 1){
        cin >> x ;
        V.push_back(x);
    }
    else if (o == 2){

        V.pop_back();
    }
    else if (o == 3){
           cin >> x ;
            ostream_iterator < int > out (cout , " "); bool k = false ;
            copy_if (V.begin(),V.end(),out,[&k,x](int val){return (val <= x) && (k = true) ;} );
            if ( !k )
                cout << "Empty" ;

                cout << '\n' ;
    }

}

return (0);
}