#include <bits/stdc++.h>

using namespace std;

int main() {
    ios::sync_with_stdio(false);

    int ops;
    cin >> ops;

    vector < int > v;
    while(ops--) {
        int type;
        cin >> type;

        if(type == 1) {
            int x;
            cin >> x;

            v.push_back(x);
        } else {
            if(type == 2) {
                v.pop_back();
            } else {
                int x;
                cin >> x;

                int cnt = 0;
                for(auto const &it: v) {
                    if(it <= x) {
                        cout << it << " ";
                        cnt++;
                    }
                }

                if(cnt == 0) {
                    cout << "Empty\n";
                } else {
                    cout << "\n";
                }
            }
        }
    }

    cout << "\n";
    return 0;
}