#define _CRT_SECURE_NO_WARNINGS
#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING
#include <bits/stdc++.h>
using namespace std;
int main()
{
    multiset<int> s;
    int n, x;
    char buf[20];
    for (; ~scanf("%d", &n); putchar('\n'), s.clear())
        for (int i = 0; i < n; i++)
            if (scanf("%s%d", buf, &x), buf[1] == 'u')
                s.insert(x);
            else
            {
                auto ite = s.upper_bound(x);
                if (ite != s.begin())
                    printf("%d\n", *--ite), s.erase(ite);
                else
                    puts("No Element!");
            }
    return 0;
}