http://acm.hdu.edu.cn/showproblem.php?pid=2275
//1280467 2009-04-17 18:03:56 Time Limit Exceeded 2275 1000MS 388K 1448 B C++ no way 
//1280554 2009-04-17 18:30:28 Accepted 2275 109MS 2416K 665 B C++ no way 
#include<iostream>
#include
<set>
using namespace std;
int main()
{
    
int n,a;
    
char op[5];
    
while(cin>>n)
    
{
        multiset
<int>S;
        multiset
<int>::iterator p,q;
        
while(n--)
        
{
            scanf(
"%s%d",op,&a);
            
if(op[3== 'h')
                S.insert(a);
            
else
            
{
                p 
= S.begin();
                
if(*> a)
                
{
                    printf(
"No Element!\n");
                    
continue;
                }

                p 
= S.find(a);
                
if(p!=S.end())
                
{
                    printf(
"%d\n",*p);
                    S.erase(p);
                }

                
else
                
{
                    S.insert(a);
                    p 
= q = S.find(a);
                    p 
-- ;
                    printf(
"%d\n",*p);
                    S.erase(p);
                    S.erase(q);
                }

            }
//while(n--)
        }

        printf(
"\n");
    }

    
return 0;
}