#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n;
    vector<pair<string,int> > op,res;
    map<int,int> m;
    scanf("%d",&n);
    char t[10];
    for(int i=0;i<n;i++)
    {
        scanf("%s",t);
        if(!strcmp(t,"insert"))
        {
            int x;
            scanf("%d",&x);
            op.push_back(make_pair("insert",x));

        }
        else if(!strcmp(t,"getMin"))
        {
            int x;
            scanf("%d",&x);
            op.push_back(make_pair("getMin",x));
        }
        else
        {
            op.push_back(make_pair("removeMin",1));
        }
    }

    int s = op.size();

    for(int i=0;i<n;i++)
    {
        if(op[i].first.compare("insert")==0)
        {
            res.push_back(op[i]);
            m[op[i].second]++;
            cout<<m[op[i].second]<<endl;
        }
        else if(op[i].first.compare("removeMin")==0)
        {
            if(m.empty())
            {
                res.push_back(make_pair("insert",1));
                res.push_back(make_pair("removeMin",1));
            }
            else if(m.begin()->second > 0)
                {
                    m.begin()->second--;
                    res.push_back(make_pair("removeMin",1));
                    if(m.begin()->second==0)
                        m.erase(m.begin());
                }
            else
                m.erase(m.begin());
        }
        else if(op[i].first.compare("getMin")==0)
        {
            if(m.empty())
            {
                res.push_back(make_pair("insert",op[i].second));
                res.push_back(make_pair("getMin",op[i].second));
            }
            else
            {
                if(m.begin()->first!=op[i].second)
                {
                    //cout<<"Minimum "<<m.begin()->first<<endl;
                    map<int,int> :: iterator it,it2;
                    for(it=m.begin();it!=m.end();it++)
                    {
                        //cout<<it->first<<" "<<op[i].second<<endl;
                        if(it->first < op[i].second)
                        {
                            int p = it->second;
                            //cout<<"p : "<<p<<endl;
                            while(p--)
                            {
                                res.push_back(make_pair("removeMin",1));
                            }
                            it2=it;
                            m.erase(it2);
                        }
                        else
                            break;
                    }
                }

                if(m.begin()->first!=op[i].second)
                {
                res.push_back(make_pair("insert",op[i].second));
                res.push_back(make_pair("getMin",op[i].second));
                }
                else
                     res.push_back(make_pair("getMin",op[i].second));
            }

        }
    }

    int ans=res.size();
    cout<<ans<<endl;
    for(int i=0;i<ans;i++)
    {
        if(res[i].first.compare("insert")==0)
            cout<<"insert "<<res[i].second<<endl;
        else if(res[i].first.compare("getMin")==0)
            cout<<"getMin "<<res[i].second<<endl;
        else
            cout<<"removeMin"<<endl;

    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n;
    vector<pair<string,int> > op,res;
    map<int,int> m;
    scanf("%d",&n);
    char t[10];
    for(int i=0;i<n;i++)
    {
        scanf("%s",t);
        if(!strcmp(t,"insert"))
        {
            int x;
            scanf("%d",&x);
            op.push_back(make_pair("insert",x));

        }
        else if(!strcmp(t,"getMin"))
        {
            int x;
            scanf("%d",&x);
            op.push_back(make_pair("getMin",x));
        }
        else
        {
            op.push_back(make_pair("removeMin",1));
        }
    }

    int s = op.size();

    for(int i=0;i<n;i++)
    {
        if(op[i].first.compare("insert")==0)
        {
            res.push_back(op[i]);
            m[op[i].second]++;
            //cout<<m[op[i].second]<<endl;
        }
        else if(op[i].first.compare("removeMin")==0)
        {
            if(m.empty())
            {
                res.push_back(make_pair("insert",1));
                res.push_back(make_pair("removeMin",1));
            }
            else if(m.begin()->second > 0)
                {
                    m.begin()->second--;
                    res.push_back(make_pair("removeMin",1));
                    if(m.begin()->second==0)
                        m.erase(m.begin());
                }
            else
                m.erase(m.begin());
        }
        else if(op[i].first.compare("getMin")==0)
        {
            if(m.empty())
            {
                res.push_back(make_pair("insert",op[i].second));
                m[op[i].second]++;
                res.push_back(make_pair("getMin",op[i].second));
            }
            else
            {
                if(m.begin()->first!=op[i].second)
                {
                    //cout<<"Minimum "<<m.begin()->first<<endl;
                    map<int,int> :: iterator it,it2;
                    for(it=m.begin();it!=m.end();it++)
                    {
                        //cout<<it->first<<" "<<op[i].second<<endl;
                        if(it->first < op[i].second)
                        {
                            int p = it->second;
                            //cout<<"p : "<<p<<endl;
                            while(p--)
                            {
                                res.push_back(make_pair("removeMin",1));
                            }
                            it2=it;
                            m.erase(it2);
                        }
                        else
                            break;
                    }
                }

                if(m.begin()->first!=op[i].second)
                {
                res.push_back(make_pair("insert",op[i].second));
                m[op[i].second]++;
                res.push_back(make_pair("getMin",op[i].second));
                }
                else
                     res.push_back(make_pair("getMin",op[i].second));
            }

        }
    }

    int ans=res.size();
    cout<<ans<<endl;
    for(int i=0;i<ans;i++)
    {
        if(res[i].first.compare("insert")==0)
            cout<<"insert "<<res[i].second<<endl;
        else if(res[i].first.compare("getMin")==0)
            cout<<"getMin "<<res[i].second<<endl;
        else
            cout<<"removeMin"<<endl;

    }
    return 0;
}


#include <iostream>
#include <algorithm>
#include <vector>
#include <math.h>
#include<deque>
#include<queue>
using namespace std;

int main()
{
    long long n,i,j,k,min=123456706076596;
    cin>>n;
    string s[123456];
    long long a[123456];
    deque<string> ans;
    deque<long long> val;
    long long count=0;
    std::priority_queue<int, std::vector<int>, std::greater<int> > pq;
    for(i=0;i<n;i++)
    {
        cin>>s[i];
        if(s[i]=="getMin" || s[i]=="insert")
            cin>>a[i];
    }
    for(i=0;i<n;i++)
    {
        if(s[i]=="insert")
        {
            //cout<<"insert "<<a[i]<<endl;
            ans.push_back(s[i]);
            val.push_back(a[i]);

                pq.push(a[i]);
        }
        else if(s[i]=="removeMin")
        {
            //cout<<"removeMin"<<endl;
            if(pq.empty())
            {
                ans.push_back("insert");
                val.push_back(3);
                pq.push(3);
            }
            ans.push_back(s[i]);
            val.push_back(0);
            pq.pop();
        }
        else
        {
            if(!pq.empty())
            {
                if(a[i]==pq.top())
                {
                    //cout<<s[i]<<" "<<a[i];
                    ans.push_back(s[i]);
                    val.push_back(a[i]);
                }
                else if(a[i]<pq.top())
                {
                //cout<<"insert "<<a[i]<<endl;
                    ans.push_back("insert");
                    val.push_back(a[i]);
                    pq.push(a[i]);

                //cout<<s[i]<<" "<<a[i];
                    ans.push_back(s[i]);
                    val.push_back(a[i]);
                }
                else
                {
                     while(!pq.empty() && pq.top()<a[i])
                     {
                    //cout<<"removeMin"<<endl;
                          ans.push_back("removeMin");
                            val.push_back(0);
                            pq.pop();
                     }
                    if(!pq.empty())
                    {
                         if(pq.top()==a[i])
                         {
                             //cout<<s[i]<<" "<<a[i];
                              ans.push_back(s[i]);
                              val.push_back(a[i]);
                         }
                         else if(a[i]<pq.top())
                         {
                        //cout<<"insert "<<a[i]<<endl;
                            ans.push_back("insert");
                            val.push_back(a[i]);
                            pq.push(a[i]);

                        //cout<<s[i]<<" "<<a[i]<<endl;
                             ans.push_back(s[i]);
                             val.push_back(a[i]);
                         }
                    }
                     else
                    {
                    //cout<<"insert "<<a[i]<<endl;
                    ans.push_back("insert");
                    val.push_back(a[i]);
                    pq.push(a[i]);

                    //cout<<s[i]<<" "<<a[i]<<endl;
                    ans.push_back(s[i]);
                    val.push_back(a[i]);
                    }
                }
            }
            else
            {
                ans.push_back("insert");
                val.push_back(a[i]);
                pq.push(a[i]);

                //cout<<s[i]<<" "<<a[i]<<endl;
                ans.push_back(s[i]);
                val.push_back(a[i]);
            }
        }
    }
    cout<<ans.size()<<endl;
    j=ans.size();
    for(i=0;i<j;i++)
    {
        if(ans[i]=="insert" || ans[i]=="getMin")
            cout<<ans[i]<<" "<<val[i]<<endl;
        else cout<<ans[i]<<endl;
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;

int main()
{
	long long n,i,j,k,min=123456706076596;
	cin>>n;
	string s[123456];
	int a[123456];
	deque<long long> st;
	deque<string> ans;
	deque<long long> val;
	long long count=0;
	for(i=0;i<n;i++)
	{
		cin>>s[i];
		if(s[i]=="getMin" || s[i]=="insert")
			cin>>a[i];
	}
	for(i=0;i<n;i++)
	{
		if(s[i]=="insert")
		{
			//cout<<"insert "<<a[i]<<endl;
			ans.push_back(s[i]);
			val.push_back(a[i]);
			if(a[i]<min);
				min=a[i];
			st.push_back(min);
		}
		else if(s[i]=="removeMin")
		{
			//cout<<"removeMin"<<endl;
			if(st.empty())
			{
				ans.push_back("insert");
				val.push_back(3);
				min=3;
				st.push_back(min);
			}
			ans.push_back(s[i]);
			val.push_back(0);
			st.pop_back();
			if(st.empty())
				min=123436456747767;
		}
		else
		{
			if(!st.empty() && a[i]==st.back())
			{
				//cout<<s[i]<<" "<<a[i];
				ans.push_back(s[i]);
				val.push_back(a[i]);
			}
			else if(!st.empty() && a[i]<st.back())
			{
				//cout<<"insert "<<a[i]<<endl;
				ans.push_back("insert");
				val.push_back(a[i]);
				if(a[i]<min);
				{
					min=a[i];
				}
				st.push_back(min);

				//cout<<s[i]<<" "<<a[i];
				ans.push_back(s[i]);
				val.push_back(a[i]);
			}
			else
			{
				while(!st.empty() && st.back()<a[i])
				{
					//cout<<"removeMin"<<endl;
					ans.push_back("removeMin");
					val.push_back(0);
					st.pop_back();
				}
				if(!st.empty())
				{
				if(st.back()==a[i])
				{
					//cout<<s[i]<<" "<<a[i];
					ans.push_back(s[i]);
					val.push_back(a[i]);
				}
				else if(a[i]<st.back())
				{
					//cout<<"insert "<<a[i]<<endl;
					ans.push_back("insert");
					val.push_back(a[i]);
					if(a[i]<min);
					{
						min=a[i];
					}
					st.push_back(min);

					//cout<<s[i]<<" "<<a[i]<<endl;
					ans.push_back(s[i]);
					val.push_back(a[i]);
				}
				}
				else
				{
					//cout<<"insert "<<a[i]<<endl;
					ans.push_back("insert");
					val.push_back(a[i]);
					min=a[i];
					st.push_back(min);

					//cout<<s[i]<<" "<<a[i]<<endl;
					ans.push_back(s[i]);
					val.push_back(a[i]);
				}
			}
		}
	}
	cout<<ans.size()<<endl;
	j=ans.size();
	for(i=0;i<j;i++)
	{
		if(ans[i]=="insert" || ans[i]=="getMin")
			cout<<ans[i]<<" "<<val[i]<<endl;
		else cout<<ans[i]<<endl;
	}
	return 0;
}


#include <iostream>
#include <algorithm>
#include <vector>
#include <math.h>
#include<deque>
using namespace std;

int main()
{
    long long n,i,j,k,min=123456706076596;
    cin>>n;
    string s[123456];
    int a[123456];
    deque<long long> st;
    deque<string> ans;
    deque<long long> val;
    long long count=0;
    for(i=0;i<n;i++)
    {
        cin>>s[i];
        if(s[i]=="getMin" || s[i]=="insert")
            cin>>a[i];
    }
    for(i=0;i<n;i++)
    {
        if(s[i]=="insert")
        {
            //cout<<"insert "<<a[i]<<endl;
            ans.push_back(s[i]);
            val.push_back(a[i]);
            if(a[i]<min)
            min=a[i];
            st.push_back(min);
        }
        else if(s[i]=="removeMin")
        {
            //cout<<"removeMin"<<endl;
            if(st.empty())
            {
                ans.push_back("insert");
                val.push_back(3);
                min=3;
                st.push_back(min);
            }
            ans.push_back(s[i]);
            val.push_back(0);
            st.pop_back();
            if(st.empty())
                min=123436456747767;
        }
        else
        {
            if(!st.empty())
            {
            if(a[i]==st.back())
            {
                //cout<<s[i]<<" "<<a[i];
                ans.push_back(s[i]);
                val.push_back(a[i]);
            }
            else if(a[i]<st.back())
            {
                //cout<<"insert "<<a[i]<<endl;
                ans.push_back("insert");
                val.push_back(a[i]);
                min=a[i];
                st.push_back(min);

                //cout<<s[i]<<" "<<a[i];
                ans.push_back(s[i]);
                val.push_back(a[i]);
            }
            else
            {
                while(!st.empty() && st.back()<a[i])
                {
                    //cout<<"removeMin"<<endl;
                    ans.push_back("removeMin");
                    val.push_back(0);
                    st.pop_back();
                }
                if(!st.empty())
                {
                    if(st.back()==a[i])
                    {
                        //cout<<s[i]<<" "<<a[i];
                        ans.push_back(s[i]);
                        val.push_back(a[i]);
                        min=a[i];
                    }
                    else if(a[i]<st.back())
                    {
                        //cout<<"insert "<<a[i]<<endl;
                        ans.push_back("insert");
                        val.push_back(a[i]);
                            min=a[i];
                        st.push_back(min);

                        //cout<<s[i]<<" "<<a[i]<<endl;
                        ans.push_back(s[i]);
                        val.push_back(a[i]);
                    }
                }
                else
                {
                    //cout<<"insert "<<a[i]<<endl;
                    ans.push_back("insert");
                    val.push_back(a[i]);
                    min=a[i];
                    st.push_back(min);

                    //cout<<s[i]<<" "<<a[i]<<endl;
                    ans.push_back(s[i]);
                    val.push_back(a[i]);
                }
            }
            }
            else
            {
                ans.push_back("insert");
                val.push_back(a[i]);
                min=a[i];
                st.push_back(min);

                //cout<<s[i]<<" "<<a[i]<<endl;
                ans.push_back(s[i]);
                val.push_back(a[i]);
            }
        }
    }
    cout<<ans.size()<<endl;
    j=ans.size();
    for(i=0;i<j;i++)
    {
        if(ans[i]=="insert" || ans[i]=="getMin")
            cout<<ans[i]<<" "<<val[i]<<endl;
        else cout<<ans[i]<<endl;
    }
    return 0;
}


#include <iostream>
#include <algorithm>
#include <vector>
#include <math.h>
#include<deque>
#include<queue>
using namespace std;

int main()
{
    long long n,i,j,k,min=123456706076596;
    cin>>n;
    string s[123456];
    long long a[123456];
    vector<string> ans;
    vector<long long> val;
    long long count=0;
    std::priority_queue<int, std::vector<int>, std::greater<int> > pq;
    for(i=0;i<n;i++)
    {
        cin>>s[i];
        if(s[i]=="getMin" || s[i]=="insert")
            cin>>a[i];
    }
    for(i=0;i<n;i++)
    {
        if(s[i]=="insert")
        {
            //cout<<"insert "<<a[i]<<endl;
            ans.push_back(s[i]);
            val.push_back(a[i]);

                pq.push(a[i]);
        }
        else if(s[i]=="removeMin")
        {
            //cout<<"removeMin"<<endl;
            if(pq.empty())
            {
                ans.push_back("insert");
                val.push_back(3);
                pq.push(3);
            }
            ans.push_back(s[i]);
            val.push_back(0);
            pq.pop();
        }
        else
        {
            if(!pq.empty())
            {
                if(a[i]==pq.top())
                {
                    //cout<<s[i]<<" "<<a[i];
                    ans.push_back(s[i]);
                    val.push_back(a[i]);
                }
                else if(a[i]<pq.top())
                {
                //cout<<"insert "<<a[i]<<endl;
                    ans.push_back("insert");
                    val.push_back(a[i]);
                    pq.push(a[i]);

                //cout<<s[i]<<" "<<a[i];
                    ans.push_back(s[i]);
                    val.push_back(a[i]);
                }
                else
                {
                     while(!pq.empty() && pq.top()<a[i])
                     {
                    //cout<<"removeMin"<<endl;
                          ans.push_back("removeMin");
                            val.push_back(0);
                            pq.pop();
                     }
                    if(!pq.empty())
                    {
                         if(pq.top()==a[i])
                         {
                             //cout<<s[i]<<" "<<a[i];
                              ans.push_back(s[i]);
                              val.push_back(a[i]);
                         }
                         else if(a[i]<pq.top())
                         {
                        //cout<<"insert "<<a[i]<<endl;
                            ans.push_back("insert");
                            val.push_back(a[i]);
                            pq.push(a[i]);

                        //cout<<s[i]<<" "<<a[i]<<endl;
                             ans.push_back(s[i]);
                             val.push_back(a[i]);
                         }
                    }
                     else
                    {
                    //cout<<"insert "<<a[i]<<endl;
                    ans.push_back("insert");
                    val.push_back(a[i]);
                    pq.push(a[i]);

                    //cout<<s[i]<<" "<<a[i]<<endl;
                    ans.push_back(s[i]);
                    val.push_back(a[i]);
                    }
                }
            }
            else
            {
                ans.push_back("insert");
                val.push_back(a[i]);
                pq.push(a[i]);

                //cout<<s[i]<<" "<<a[i]<<endl;
                ans.push_back(s[i]);
                val.push_back(a[i]);
            }
        }
    }
    cout<<ans.size()<<endl;
    j=ans.size();
    for(i=0;i<j;i++)
    {
        if(ans[i]=="insert" || ans[i]=="getMin")
            cout<<ans[i]<<" "<<val[i]<<endl;
        else cout<<ans[i]<<endl;
    }
    return 0;
}


#include <iostream>
#include <algorithm>
#include <vector>
#include <math.h>
#include<deque>
#include<queue>
using namespace std;

int main()
{
    long long n,i,j,k,min=123456706076596;
    cin>>n;
    string s[123456];
    long long a[123456];
    vector<string> ans;
    vector<long long> val;
    long long count=0;
    std::priority_queue<long long, std::vector<long long>, std::greater<long long> > pq;
    for(i=0;i<n;i++)
    {
        cin>>s[i];
        if(s[i]=="getMin" || s[i]=="insert")
            cin>>a[i];
    }
    for(i=0;i<n;i++)
    {
        if(s[i]=="insert")
        {
            //cout<<"insert "<<a[i]<<endl;
            ans.push_back(s[i]);
            val.push_back(a[i]);
            pq.push(a[i]);
        }
        else if(s[i]=="removeMin")
        {
            //cout<<"removeMin"<<endl;
            if(pq.empty())
            {
                ans.push_back("insert");
                val.push_back(3);
                pq.push(3);
            }
            ans.push_back(s[i]);
            val.push_back(0);
            pq.pop();
        }
        else
        {
            if(!pq.empty())
            {
                if(a[i]==pq.top())
                {
                    //cout<<s[i]<<" "<<a[i];
                    ans.push_back(s[i]);
                    val.push_back(a[i]);
                }
                else if(a[i]<pq.top())
                {
                //cout<<"insert "<<a[i]<<endl;
                    ans.push_back("insert");
                    val.push_back(a[i]);
                    pq.push(a[i]);

                //cout<<s[i]<<" "<<a[i];
                    ans.push_back(s[i]);
                    val.push_back(a[i]);
                }
                else
                {
                     while(!pq.empty() && pq.top()<a[i])
                     {
                    //cout<<"removeMin"<<endl;
                          ans.push_back("removeMin");
                            val.push_back(0);
                            pq.pop();
                     }
                    if(!pq.empty())
                    {
                         if(pq.top()==a[i])
                         {
                             //cout<<s[i]<<" "<<a[i];
                              ans.push_back(s[i]);
                              val.push_back(a[i]);
                         }
                         else if(a[i]<pq.top())
                         {
                        //cout<<"insert "<<a[i]<<endl;
                            ans.push_back("insert");
                            val.push_back(a[i]);
                            pq.push(a[i]);

                        //cout<<s[i]<<" "<<a[i]<<endl;
                             ans.push_back(s[i]);
                             val.push_back(a[i]);
                         }
                    }
                     else
                    {
                    //cout<<"insert "<<a[i]<<endl;
                    ans.push_back("insert");
                    val.push_back(a[i]);
                    pq.push(a[i]);

                    //cout<<s[i]<<" "<<a[i]<<endl;
                    ans.push_back(s[i]);
                    val.push_back(a[i]);
                    }
                }
            }
            else
            {
                ans.push_back("insert");
                val.push_back(a[i]);
                pq.push(a[i]);

                //cout<<s[i]<<" "<<a[i]<<endl;
                ans.push_back(s[i]);
                val.push_back(a[i]);
            }
        }
    }
    cout<<ans.size()<<endl;
    j=ans.size();
    for(i=0;i<j;i++)
    {
        if(ans[i]=="insert" || ans[i]=="getMin")
            cout<<ans[i]<<" "<<val[i]<<endl;
        else cout<<ans[i]<<endl;
    }
    return 0;
}


#include <iostream>
#include <algorithm>
#include <vector>
#include <math.h>
#include<deque>
using namespace std;

int main()
{
    long long n,i,j,k,min=123456706076596;
    cin>>n;
    string s[123456];
    int a[123456];
    deque<long long> st;
    deque<string> ans;
    deque<long long> val;
    long long count=0;
    for(i=0;i<n;i++)
    {
        cin>>s[i];
        if(s[i]=="getMin" || s[i]=="insert")
            cin>>a[i];
    }
    for(i=0;i<n;i++)
    {
        if(s[i]=="insert")
        {
            //cout<<"insert "<<a[i]<<endl;
            ans.push_back(s[i]);
            val.push_back(a[i]);
            if(a[i]<min)
            min=a[i];
            st.push_back(min);
        }
        else if(s[i]=="removeMin")
        {
            //cout<<"removeMin"<<endl;
            if(st.empty())
            {
                ans.push_back("insert");
                val.push_back(3);
                min=3;
                st.push_back(min);
            }
            ans.push_back(s[i]);
            val.push_back(0);
            st.pop_back();
            if(st.empty())
                min=123436456747767;
        }
        else
        {
            if(!st.empty())
            {
            if(a[i]==st.back())
            {
                //cout<<s[i]<<" "<<a[i];
                ans.push_back(s[i]);
                val.push_back(a[i]);
            }
            else if(a[i]<st.back())
            {
                //cout<<"insert "<<a[i]<<endl;
                ans.push_back("insert");
                val.push_back(a[i]);
                min=a[i];
                st.push_back(min);

                //cout<<s[i]<<" "<<a[i];
                ans.push_back(s[i]);
                val.push_back(a[i]);
            }
            else
            {
                while(!st.empty() && st.back()<a[i])
                {
                    //cout<<"removeMin"<<endl;
                    ans.push_back("removeMin");
                    val.push_back(0);
                    st.pop_back();
                }
                if(!st.empty())
                {
                    if(st.back()==a[i])
                    {
                        //cout<<s[i]<<" "<<a[i];
                        ans.push_back(s[i]);
                        val.push_back(a[i]);
                        min=a[i];
                    }
                    else if(a[i]<st.back())
                    {
                        //cout<<"insert "<<a[i]<<endl;
                        ans.push_back("insert");
                        val.push_back(a[i]);
                            min=a[i];
                        st.push_back(min);

                        //cout<<s[i]<<" "<<a[i]<<endl;
                        ans.push_back(s[i]);
                        val.push_back(a[i]);
                    }
                }
                else
                {
                    //cout<<"insert "<<a[i]<<endl;
                    ans.push_back("insert");
                    val.push_back(a[i]);
                    min=a[i];
                    st.push_back(a[i]);

                    //cout<<s[i]<<" "<<a[i]<<endl;
                    ans.push_back(s[i]);
                    val.push_back(a[i]);
                }
            }
            }
            else
            {
                ans.push_back("insert");
                val.push_back(a[i]);
                min=a[i];
                st.push_back(a[i]);

                //cout<<s[i]<<" "<<a[i]<<endl;
                ans.push_back(s[i]);
                val.push_back(a[i]);
            }
        }
        if(st.empty())
            min=1232343758395354;
        else min=st.back();
    }
    cout<<ans.size()<<endl;
    j=ans.size();
    for(i=0;i<j;i++)
    {
        if(ans[i]=="insert" || ans[i]=="getMin")
            cout<<ans[i]<<" "<<val[i]<<endl;
        else cout<<ans[i]<<endl;
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;

int main()
{
	long long n,i,j,k,min=123456706076596;
	cin>>n;
	string s[123456];
	int a[123456];
	deque<long long> st;
	deque<string> ans;
	deque<long long> val;
	long long count=0;
	for(i=0;i<n;i++)
	{
		cin>>s[i];
		if(s[i]=="getMin" || s[i]=="insert")
			cin>>a[i];
	}
	for(i=0;i<n;i++)
	{
		if(s[i]=="insert")
		{
			//cout<<"insert "<<a[i]<<endl;
			ans.push_back(s[i]);
			val.push_back(a[i]);
			if(a[i]<min);
				min=a[i];
			st.push_back(min);
		}
		else if(s[i]=="removeMin")
		{
			//cout<<"removeMin"<<endl;
			if(st.empty())
			{
				ans.push_back("insert");
				val.push_back(3);
				min=3;
				st.push_back(min);
			}
			ans.push_back(s[i]);
			val.push_back(0);
			st.pop_back();
		}
		else
		{
			if(!st.empty() && a[i]==st.back())
			{
				//cout<<s[i]<<" "<<a[i];
				ans.push_back(s[i]);
				val.push_back(a[i]);
			}
			else if(!st.empty() && a[i]<st.back())
			{
				//cout<<"insert "<<a[i]<<endl;
				ans.push_back("insert");
				val.push_back(a[i]);
				if(a[i]<min);
				{
					min=a[i];
				}
				st.push_back(min);

				//cout<<s[i]<<" "<<a[i];
				ans.push_back(s[i]);
				val.push_back(a[i]);
			}
			else
			{
				while(!st.empty() && st.back()<a[i])
				{
					//cout<<"removeMin"<<endl;
					ans.push_back("removeMin");
					val.push_back(0);
					st.pop_back();
				}
				if(!st.empty())
				{
				if(st.back()==a[i])
				{
					//cout<<s[i]<<" "<<a[i];
					ans.push_back(s[i]);
					val.push_back(a[i]);
				}
				else if(a[i]<st.back())
				{
					//cout<<"insert "<<a[i]<<endl;
					ans.push_back("insert");
					val.push_back(a[i]);
					if(a[i]<min);
					{
						min=a[i];
					}
					st.push_back(min);

					//cout<<s[i]<<" "<<a[i]<<endl;
					ans.push_back(s[i]);
					val.push_back(a[i]);
				}
				}
				else
				{
					//cout<<"insert "<<a[i]<<endl;
					ans.push_back("insert");
					val.push_back(a[i]);
					min=a[i];
					st.push_back(min);

					//cout<<s[i]<<" "<<a[i]<<endl;
					ans.push_back(s[i]);
					val.push_back(a[i]);
				}
			}
		}
	}
	cout<<ans.size()<<endl;
	j=ans.size();
	for(i=0;i<j;i++)
	{
		if(ans[i]=="insert" || ans[i]=="getMin")
			cout<<ans[i]<<" "<<val[i]<<endl;
		else cout<<ans[i]<<endl;
	}
	return 0;
}


#include <iostream>
#include <algorithm>
#include <vector>
#include <math.h>
#include<deque>
using namespace std;

int main()
{
    long long n,i,j,k,min=123456706076596;
    cin>>n;
    string s[123456];
    int a[123456];
    deque<long long> st;
    deque<string> ans;
    deque<long long> val;
    long long count=0;
    for(i=0;i<n;i++)
    {
        cin>>s[i];
        if(s[i]=="getMin" || s[i]=="insert")
            cin>>a[i];
    }
    for(i=0;i<n;i++)
    {
        if(s[i]=="insert")
        {
            //cout<<"insert "<<a[i]<<endl;
            ans.push_back(s[i]);
            val.push_back(a[i]);
            if(a[i]<min)
            min=a[i];
            st.push_back(min);
        }
        else if(s[i]=="removeMin")
        {
            //cout<<"removeMin"<<endl;
            if(st.empty())
            {
                ans.push_back("insert");
                val.push_back(3);
                min=3;
                st.push_back(min);
            }
            ans.push_back(s[i]);
            val.push_back(0);
            st.pop_back();
            if(st.empty())
                min=123436456747767;
        }
        else
        {
            if(!st.empty())
            {
            if(a[i]==st.back())
            {
                //cout<<s[i]<<" "<<a[i];
                ans.push_back(s[i]);
                val.push_back(a[i]);
            }
            else if(a[i]<st.back())
            {
                //cout<<"insert "<<a[i]<<endl;
                ans.push_back("insert");
                val.push_back(a[i]);
                if(a[i]<min)
                {
                    min=a[i];
                }
                st.push_back(min);

                //cout<<s[i]<<" "<<a[i];
                ans.push_back(s[i]);
                val.push_back(a[i]);
            }
            else
            {
                while(!st.empty() && st.back()<a[i])
                {
                    //cout<<"removeMin"<<endl;
                    ans.push_back("removeMin");
                    val.push_back(0);
                    st.pop_back();
                }
                if(!st.empty())
                {
                    if(st.back()==a[i])
                    {
                        //cout<<s[i]<<" "<<a[i];
                        ans.push_back(s[i]);
                        val.push_back(a[i]);
                    }
                    else if(a[i]<st.back())
                    {
                        //cout<<"insert "<<a[i]<<endl;
                        ans.push_back("insert");
                        val.push_back(a[i]);
                        if(a[i]<min)
                        {
                            min=a[i];
                        }
                        st.push_back(min);

                        //cout<<s[i]<<" "<<a[i]<<endl;
                        ans.push_back(s[i]);
                        val.push_back(a[i]);
                    }
                }
                else
                {
                    //cout<<"insert "<<a[i]<<endl;
                    ans.push_back("insert");
                    val.push_back(a[i]);
                    min=a[i];
                    st.push_back(min);

                    //cout<<s[i]<<" "<<a[i]<<endl;
                    ans.push_back(s[i]);
                    val.push_back(a[i]);
                }
            }
            }
            else
            {
                ans.push_back("insert");
                val.push_back(a[i]);
                min=a[i];
                st.push_back(min);

                //cout<<s[i]<<" "<<a[i]<<endl;
                ans.push_back(s[i]);
                val.push_back(a[i]);
            }
        }
    }
    cout<<ans.size()<<endl;
    j=ans.size();
    for(i=0;i<j;i++)
    {
        if(ans[i]=="insert" || ans[i]=="getMin")
            cout<<ans[i]<<" "<<val[i]<<endl;
        else cout<<ans[i]<<endl;
    }
    return 0;
}


#include <iostream>
#include <algorithm>
#include <vector>
#include <math.h>
#include<deque>
using namespace std;

int main()
{
    long long n,i,j,k,min=123456706076596;
    cin>>n;
    string s[123456];
    long long a[123456];
    deque<long long> st;
    deque<string> ans;
    deque<long long> val;
    long long count=0;
    for(i=0;i<n;i++)
    {
        cin>>s[i];
        if(s[i]=="getMin" || s[i]=="insert")
            cin>>a[i];
    }
    for(i=0;i<n;i++)
    {
        if(s[i]=="insert")
        {
            //cout<<"insert "<<a[i]<<endl;
            ans.push_back(s[i]);
            val.push_back(a[i]);
            if(a[i]<min)
                st.push_back(a[i]);
            else st.push_back(min);
        }
        else if(s[i]=="removeMin")
        {
            //cout<<"removeMin"<<endl;
            if(st.empty())
            {
                ans.push_back("insert");
                val.push_back(3);
                st.push_back(3);
            }
            ans.push_back(s[i]);
            val.push_back(0);
            st.pop_back();
        }
        else
        {
            if(!st.empty())
            {
                if(a[i]==st.back())
                {
                    //cout<<s[i]<<" "<<a[i];
                    ans.push_back(s[i]);
                    val.push_back(a[i]);
                }
                else if(a[i]<st.back())
                {
                //cout<<"insert "<<a[i]<<endl;
                    ans.push_back("insert");
                    val.push_back(a[i]);
                    st.push_back(a[i]);

                //cout<<s[i]<<" "<<a[i];
                    ans.push_back(s[i]);
                    val.push_back(a[i]);
                }
                else
                {
                     while(!st.empty() && st.back()<a[i])
                     {
                    //cout<<"removeMin"<<endl;
                          ans.push_back("removeMin");
                            val.push_back(0);
                            st.pop_back();
                     }
                    if(!st.empty())
                    {
                         if(st.back()==a[i])
                         {
                             //cout<<s[i]<<" "<<a[i];
                              ans.push_back(s[i]);
                              val.push_back(a[i]);
                         }
                         else if(a[i]<st.back())
                         {
                        //cout<<"insert "<<a[i]<<endl;
                            ans.push_back("insert");
                            val.push_back(a[i]);
                            st.push_back(a[i]);

                        //cout<<s[i]<<" "<<a[i]<<endl;
                             ans.push_back(s[i]);
                             val.push_back(a[i]);
                         }
                    }
                     else
                    {
                    //cout<<"insert "<<a[i]<<endl;
                    ans.push_back("insert");
                    val.push_back(a[i]);
                    st.push_back(a[i]);

                    //cout<<s[i]<<" "<<a[i]<<endl;
                    ans.push_back(s[i]);
                    val.push_back(a[i]);
                    }
                }
            }
            else
            {
                ans.push_back("insert");
                val.push_back(a[i]);
                st.push_back(a[i]);

                //cout<<s[i]<<" "<<a[i]<<endl;
                ans.push_back(s[i]);
                val.push_back(a[i]);
            }
        }
        if(st.empty())
            min=1232343758395354;
        else min=st.back();
    }
    cout<<ans.size()<<endl;
    j=ans.size();
    for(i=0;i<j;i++)
    {
        if(ans[i]=="insert" || ans[i]=="getMin")
            cout<<ans[i]<<" "<<val[i]<<endl;
        else cout<<ans[i]<<endl;
    }
    return 0;
}


#include <iostream>
#include <algorithm>
#include <vector>
#include <math.h>
#include<deque>
using namespace std;

int main()
{
    long long n,i,j,k,min=123456706076596;
    cin>>n;
    string s[123456];
    int a[123456];
    deque<long long> st;
    deque<string> ans;
    deque<long long> val;
    long long count=0;
    for(i=0;i<n;i++)
    {
        cin>>s[i];
        if(s[i]=="getMin" || s[i]=="insert")
            cin>>a[i];
    }
    for(i=0;i<n;i++)
    {
        if(s[i]=="insert")
        {
            //cout<<"insert "<<a[i]<<endl;
            ans.push_back(s[i]);
            val.push_back(a[i]);
            if(a[i]<min)
                st.push_back(a[i]);
            else st.push_back(min);
        }
        else if(s[i]=="removeMin")
        {
            //cout<<"removeMin"<<endl;
            if(st.empty())
            {
                ans.push_back("insert");
                val.push_back(3);
                st.push_back(3);
            }
            ans.push_back(s[i]);
            val.push_back(0);
            st.pop_back();
        }
        else
        {
            if(!st.empty())
            {
                if(a[i]==st.back())
                {
                    //cout<<s[i]<<" "<<a[i];
                    ans.push_back(s[i]);
                    val.push_back(a[i]);
                }
                else if(a[i]<st.back())
                {
                //cout<<"insert "<<a[i]<<endl;
                    ans.push_back("insert");
                    val.push_back(a[i]);
                    st.push_back(a[i]);

                //cout<<s[i]<<" "<<a[i];
                    ans.push_back(s[i]);
                    val.push_back(a[i]);
                }
                else
                {
                     while(!st.empty() && st.back()<a[i])
                     {
                    //cout<<"removeMin"<<endl;
                          ans.push_back("removeMin");
                            val.push_back(0);
                            st.pop_back();
                     }
                    if(!st.empty())
                    {
                         if(st.back()==a[i])
                         {
                             //cout<<s[i]<<" "<<a[i];
                              ans.push_back(s[i]);
                              val.push_back(a[i]);
                         }
                         else if(a[i]<st.back())
                         {
                        //cout<<"insert "<<a[i]<<endl;
                            ans.push_back("insert");
                            val.push_back(a[i]);
                            st.push_back(a[i]);

                        //cout<<s[i]<<" "<<a[i]<<endl;
                             ans.push_back(s[i]);
                             val.push_back(a[i]);
                         }
                    }
                     else
                    {
                    //cout<<"insert "<<a[i]<<endl;
                    ans.push_back("insert");
                    val.push_back(a[i]);
                    st.push_back(a[i]);

                    //cout<<s[i]<<" "<<a[i]<<endl;
                    ans.push_back(s[i]);
                    val.push_back(a[i]);
                    }
                }
            }
            else
            {
                ans.push_back("insert");
                val.push_back(a[i]);
                st.push_back(a[i]);

                //cout<<s[i]<<" "<<a[i]<<endl;
                ans.push_back(s[i]);
                val.push_back(a[i]);
            }
        }
        if(st.empty())
            min=1232343758395354;
        else min=st.back();
    }
    cout<<ans.size()<<endl;
    j=ans.size();
    for(i=0;i<j;i++)
    {
        if(ans[i]=="insert" || ans[i]=="getMin")
            cout<<ans[i]<<" "<<val[i]<<endl;
        else cout<<ans[i]<<endl;
    }
    return 0;
}


#include <iostream>
#include <algorithm>
#include<stdio.h>
#include <vector>
#include <math.h>
#include<deque>
#include<queue>
using namespace std;

int main()
{
    long long n,i,j,k,min=123456706076596;
    ios_base :: sync_with_stdio(false);
    cin>>n;
    string s[123456];
    long long a[123456];
    vector<string> ans;
    vector<long long> val;
    long long count=0;
    std::priority_queue<long long, std::vector<long long>, std::greater<long long> > pq;
    for(i=0;i<n;i++)
    {
        cin>>s[i];
        if(s[i]=="getMin" || s[i]=="insert")
            cin>>a[i];
    }
    for(i=0;i<n;i++)
    {
        if(s[i]=="insert")
        {
            //cout<<"insert "<<a[i]<<endl;
            ans.push_back(s[i]);
            val.push_back(a[i]);
            pq.push(a[i]);
        }
        else if(s[i]=="removeMin")
        {
            //cout<<"removeMin"<<endl;
            if(pq.empty())
            {
                ans.push_back("insert");
                val.push_back(3);
                pq.push(3);
            }
            ans.push_back(s[i]);
            val.push_back(0);
            pq.pop();
        }
        else
        {
            if(!pq.empty())
            {
                if(a[i]==pq.top())
                {
                    //cout<<s[i]<<" "<<a[i];
                    ans.push_back(s[i]);
                    val.push_back(a[i]);
                }
                else if(a[i]<pq.top())
                {
                //cout<<"insert "<<a[i]<<endl;
                    ans.push_back("insert");
                    val.push_back(a[i]);
                    pq.push(a[i]);

                //cout<<s[i]<<" "<<a[i];
                    ans.push_back(s[i]);
                    val.push_back(a[i]);
                }
                else
                {
                     while(!pq.empty() && pq.top()<a[i])
                     {
                    //cout<<"removeMin"<<endl;
                          ans.push_back("removeMin");
                            val.push_back(0);
                            pq.pop();
                     }
                    if(!pq.empty())
                    {
                         if(pq.top()==a[i])
                         {
                             //cout<<s[i]<<" "<<a[i];
                              ans.push_back(s[i]);
                              val.push_back(a[i]);
                         }
                         else if(a[i]<pq.top())
                         {
                        //cout<<"insert "<<a[i]<<endl;
                            ans.push_back("insert");
                            val.push_back(a[i]);
                            pq.push(a[i]);

                        //cout<<s[i]<<" "<<a[i]<<endl;
                             ans.push_back(s[i]);
                             val.push_back(a[i]);
                         }
                    }
                     else
                    {
                    //cout<<"insert "<<a[i]<<endl;
                    ans.push_back("insert");
                    val.push_back(a[i]);
                    pq.push(a[i]);

                    //cout<<s[i]<<" "<<a[i]<<endl;
                    ans.push_back(s[i]);
                    val.push_back(a[i]);
                    }
                }
            }
            else
            {
                ans.push_back("insert");
                val.push_back(a[i]);
                pq.push(a[i]);

                //cout<<s[i]<<" "<<a[i]<<endl;
                ans.push_back(s[i]);
                val.push_back(a[i]);
            }
        }
    }
    cout<<ans.size()<<endl;
    j=ans.size();
    for(i=0;i<j;i++)
    {
        if(ans[i]=="insert" || ans[i]=="getMin")
            cout<<ans[i]<<" "<<val[i]<<endl;
        else cout<<ans[i]<<endl;
    }
    return 0;
}


#include <iostream>
#include <algorithm>
#include <vector>
#include <math.h>
#include<deque>
using namespace std;

int main()
{
    long long n,i,j,k,min=123456706076596;
    cin>>n;
    string s[123456];
    int a[123456];
    deque<long long> st;
    deque<string> ans;
    deque<long long> val;
    long long count=0;
    for(i=0;i<n;i++)
    {
        cin>>s[i];
        if(s[i]=="getMin" || s[i]=="insert")
            cin>>a[i];
    }
    for(i=0;i<n;i++)
    {
        if(s[i]=="insert")
        {
            //cout<<"insert "<<a[i]<<endl;
            ans.push_back(s[i]);
            val.push_back(a[i]);
            if(a[i]<min)
                min=a[i];
            st.push_back(min);
        }
        else if(s[i]=="removeMin")
        {
            //cout<<"removeMin"<<endl;
            if(st.empty())
            {
                ans.push_back("insert");
                val.push_back(3);
                min=3;
                st.push_back(min);
            }
            ans.push_back(s[i]);
            val.push_back(0);
            st.pop_back();
        }
        else
        {
            if(!st.empty())
            {
                if(a[i]==st.back())
                {
                    //cout<<s[i]<<" "<<a[i];
                    ans.push_back(s[i]);
                    val.push_back(a[i]);
                }
                else if(a[i]<st.back())
                {
                //cout<<"insert "<<a[i]<<endl;
                    ans.push_back("insert");
                    val.push_back(a[i]);
                    min=a[i];
                    st.push_back(min);

                //cout<<s[i]<<" "<<a[i];
                    ans.push_back(s[i]);
                    val.push_back(a[i]);
                }
                else
                {
                     while(!st.empty() && st.back()<a[i])
                     {
                    //cout<<"removeMin"<<endl;
                          ans.push_back("removeMin");
                            val.push_back(0);
                            st.pop_back();
                     }
                    if(!st.empty())
                    {
                         if(st.back()==a[i])
                         {
                             //cout<<s[i]<<" "<<a[i];
                              ans.push_back(s[i]);
                              val.push_back(a[i]);
                         }
                         else if(a[i]<st.back())
                         {
                        //cout<<"insert "<<a[i]<<endl;
                            ans.push_back("insert");
                            val.push_back(a[i]);
                            st.push_back(a[i]);

                        //cout<<s[i]<<" "<<a[i]<<endl;
                             ans.push_back(s[i]);
                             val.push_back(a[i]);
                         }
                    }
                     else
                    {
                    //cout<<"insert "<<a[i]<<endl;
                    ans.push_back("insert");
                    val.push_back(a[i]);
                    st.push_back(a[i]);

                    //cout<<s[i]<<" "<<a[i]<<endl;
                    ans.push_back(s[i]);
                    val.push_back(a[i]);
                    }
                }
            }
            else
            {
                ans.push_back("insert");
                val.push_back(a[i]);
                st.push_back(a[i]);

                //cout<<s[i]<<" "<<a[i]<<endl;
                ans.push_back(s[i]);
                val.push_back(a[i]);
            }
        }
        if(st.empty())
            min=1232343758395354;
        else min=st.back();
    }
    cout<<ans.size()<<endl;
    j=ans.size();
    for(i=0;i<j;i++)
    {
        if(ans[i]=="insert" || ans[i]=="getMin")
            cout<<ans[i]<<" "<<val[i]<<endl;
        else cout<<ans[i]<<endl;
    }
    return 0;
}


#include <cmath>
#include <climits>
#include <queue>
#include <vector>
#include <map>
#include <cstdlib>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <sstream>  // istringstream buffer(myString);
#include <stack>
#include <algorithm>
#include <cstring>
#include <cassert>
#include <functional>
using namespace std;
#define bit(x,i) (x&(1<<i))  //select the bit of position i of x
#define lowbit(x) ((x)&((x)^((x)-1))) //get the lowest bit of x
#define hBit(msb,n) asm("bsrl %1,%0" : "=r"(msb) : "r"(n)) //get the highest bit of x, maybe the fastest
#define max(a,b) (a<b?b:a)
#define abs(x) (x<0?(-x):x) // big bug here if "-x" is not surrounded by "()"
#define IN(i,l,r) (l<i&&i<r) //the next for are for checking bound
#define LINR(i,l,r) (l<=i&&i<=r)
#define LIN(i,l,r) (l<=i&&i<r)
#define INR(i,l,r) (l<i&&i<=r)
#define F(i,L,R) for (int i = L; i < R; i++) //next four are for "for loops"
#define FE(i,L,R) for (int i = L; i <= R; i++)
#define FF(i,L,R) for (int i = L; i > R; i--)
#define FFE(i,L,R) for (int i = L; i >= R; i--)
#define getI(a) scanf("%d", &a) //next three are handy ways to get ints, it's also force you to use '&' sign
#define getII(a,b) scanf("%d%d", &a, &b)
#define getIII(a,b,c) scanf("%d%d%d", &a, &b, &c)
#define wez(n) int (n); scanf("%d",&(n)) //handy if the input is right after the definition of a variable
#define wez2(n,m) int (n),(m); scanf("%d %d",&(n),&(m))
#define wez3(n,m,k) int (n),(m),(k); scanf("%d %d %d",&(n),&(m),&(k))
#define TESTS wez(testow);while(testow--) //for multilple cases problems
#define whileZ int T; getI(T); while(T--) // the same as above
#define getS(x) scanf("%s", x) //get a char* string
#define clr(a,x) memset(a,x,sizeof(a)) //set elements of array to some value
#define char2Int(c) (c-'0')
#define lastEle(vec) vec[vec.size()-1]
#define SZ(x) ((int)((x).size()))
#define REMAX(a,b) (a)=max((a),(b)) // set a to the maximum of a and b
#define REMIN(a,b) (a)=min((a),(b));
#define FOREACH(i,t) for (typeof(t.begin()) i=t.begin(); i!=t.end(); i++) // traverse an STL data structure
#define ALL(c) (c).begin(),(c).end() //handy for function like "sort()"
#define PRESENT(c,x) ((c).find(x) != (c).end())
#define CPRESENT(c,x) (find(ALL(c),x) != (c).end())
#define ll long long //data types used often, but you don't want to type them time by time
#define ull unsigned long long
#define ui unsigned int
#define us unsigned short
#define IOS ios_base::sync_with_stdio(0); //to synchronize the input of cin and scanf
#define INF 1001001001
#define PI 3.1415926535897932384626
//for map, pair
#define mp make_pair
#define fi first
#define se second
// for debug
inline void pisz(int n) { printf("%d\n",n); }
#define DBG(vari) cerr<<#vari<<" = "<<(vari)<<endl;
#define printA(a,L,R) FE(i,L,R) cout << a[i] << (i==R?'\n':' ')
#define printV(a) printA(a,0,a.size()-1)
#define MAXN 10000
//for vectors
#define pb push_back
typedef int elem_t;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> ii;
// directions
const int fx[4][2] = {{0,1}, {0,-1}, {1,0}, {-1,0}};
const int fxx[8][2] = {{0,1}, {0,-1}, {1,0}, {-1,0}, {1,1}, {1,-1}, {-1,1}, {-1,-1}};
template<typename T,typename TT> ostream& operator<<(ostream &s,pair<T,TT> t) {return s<<"("<<t.first<<","<<t.second<<")";}
template<typename T> ostream& operator<<(ostream &s,vector<T> t){F(i,0,SZ(t))s<<t[i]<<" ";return s; }

struct Reverse {
  bool operator()(int x, int y) {
    return y < x;
  }
};

int main()
{
// 	TESTS
	{
		// cout << "hello";
		vector < ii > cmd,ncmd;
		wez(n);
		// DBG(n);
		string str;
		int t;
		F(i,0,n)
		{
			cin >> str;
			if( str[0] == 'i' )
			{
				cin >> t;
				cmd.pb( mp(1,t) );
			}
			else if( str[0] == 'g' )
			{
				cin >> t;
				cmd.pb( mp(2,t) );
			}
			else
			{
				cmd.pb( mp(0,0) );
			}
		}
		// printV(cmd);

		priority_queue <int, vector<int>, Reverse> pq;
		F(i,0,n)
		{
			// cout << "yes"<< endl;
			if(cmd[i].first == 1)
			{
				pq.push(cmd[i].second);
				ncmd.pb(cmd[i]);
			}
			else if(cmd[i].first == 0)
			{
				if(pq.empty())
				{
					ncmd.pb( mp(1,1) );
				}
				else
					pq.pop();
				ncmd.pb(cmd[i]);
			}
			else
			{
				// DBG(pq.top());
				// DBG(cmd[i].second);
				if(pq.empty())
				{
					ncmd.pb( mp(1,cmd[i].second) );
					pq.push(cmd[i].second);
					ncmd.pb( cmd[i] );
				}
				else
				{
					if( cmd[i].second < pq.top() )
						ncmd.pb( mp(1,cmd[i].second) );
					else if( cmd[i].second > pq.top() )
					{
						while( !pq.empty() && cmd[i].second > pq.top() )
						{
							ncmd.pb( mp(0,0) );
							pq.pop();
						}
						if( pq.empty() || cmd[i].second < pq.top() )
						{
							ncmd.pb( mp(1,cmd[i].second) );
							pq.push(cmd[i].second);
						}

					}
					ncmd.pb( cmd[i] );
				}

			}
			DBG(cmd[i]);
			DBG(pq.size());

			// printV(cmd);
			// printV(ncmd);
			// cout << endl;

		}

		cout << ncmd.size() << endl;
		F(i,0,ncmd.size())
		{
			if(ncmd[i].first == 0)
				cout << "removeMin\n";
			else if(ncmd[i].first == 1)
				cout << "insert " << ncmd[i].second << endl;
			else
				cout << "getMin " << ncmd[i].second << endl;
		}
	}
	return 0;
}


#include <cmath>
#include <climits>
#include <queue>
#include <vector>
#include <map>
#include <cstdlib>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <sstream>  // istringstream buffer(myString);
#include <stack>
#include <algorithm>
#include <cstring>
#include <cassert>
#include <functional>
using namespace std;
#define bit(x,i) (x&(1<<i))  //select the bit of position i of x
#define lowbit(x) ((x)&((x)^((x)-1))) //get the lowest bit of x
#define hBit(msb,n) asm("bsrl %1,%0" : "=r"(msb) : "r"(n)) //get the highest bit of x, maybe the fastest
#define max(a,b) (a<b?b:a)
#define abs(x) (x<0?(-x):x) // big bug here if "-x" is not surrounded by "()"
#define IN(i,l,r) (l<i&&i<r) //the next for are for checking bound
#define LINR(i,l,r) (l<=i&&i<=r)
#define LIN(i,l,r) (l<=i&&i<r)
#define INR(i,l,r) (l<i&&i<=r)
#define F(i,L,R) for (int i = L; i < R; i++) //next four are for "for loops"
#define FE(i,L,R) for (int i = L; i <= R; i++)
#define FF(i,L,R) for (int i = L; i > R; i--)
#define FFE(i,L,R) for (int i = L; i >= R; i--)
#define getI(a) scanf("%d", &a) //next three are handy ways to get ints, it's also force you to use '&' sign
#define getII(a,b) scanf("%d%d", &a, &b)
#define getIII(a,b,c) scanf("%d%d%d", &a, &b, &c)
#define wez(n) int (n); scanf("%d",&(n)) //handy if the input is right after the definition of a variable
#define wez2(n,m) int (n),(m); scanf("%d %d",&(n),&(m))
#define wez3(n,m,k) int (n),(m),(k); scanf("%d %d %d",&(n),&(m),&(k))
#define TESTS wez(testow);while(testow--) //for multilple cases problems
#define whileZ int T; getI(T); while(T--) // the same as above
#define getS(x) scanf("%s", x) //get a char* string
#define clr(a,x) memset(a,x,sizeof(a)) //set elements of array to some value
#define char2Int(c) (c-'0')
#define lastEle(vec) vec[vec.size()-1]
#define SZ(x) ((int)((x).size()))
#define REMAX(a,b) (a)=max((a),(b)) // set a to the maximum of a and b
#define REMIN(a,b) (a)=min((a),(b));
#define FOREACH(i,t) for (typeof(t.begin()) i=t.begin(); i!=t.end(); i++) // traverse an STL data structure
#define ALL(c) (c).begin(),(c).end() //handy for function like "sort()"
#define PRESENT(c,x) ((c).find(x) != (c).end())
#define CPRESENT(c,x) (find(ALL(c),x) != (c).end())
#define ll long long //data types used often, but you don't want to type them time by time
#define ull unsigned long long
#define ui unsigned int
#define us unsigned short
#define IOS ios_base::sync_with_stdio(0); //to synchronize the input of cin and scanf
#define INF 1001001001
#define PI 3.1415926535897932384626
//for map, pair
#define mp make_pair
#define fi first
#define se second
// for debug
inline void pisz(int n) { printf("%d\n",n); }
#define DBG(vari) cerr<<#vari<<" = "<<(vari)<<endl;
#define printA(a,L,R) FE(i,L,R) cout << a[i] << (i==R?'\n':' ')
#define printV(a) printA(a,0,a.size()-1)
#define MAXN 10000
//for vectors
#define pb push_back
typedef int elem_t;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> ii;
// directions
const int fx[4][2] = {{0,1}, {0,-1}, {1,0}, {-1,0}};
const int fxx[8][2] = {{0,1}, {0,-1}, {1,0}, {-1,0}, {1,1}, {1,-1}, {-1,1}, {-1,-1}};
template<typename T,typename TT> ostream& operator<<(ostream &s,pair<T,TT> t) {return s<<"("<<t.first<<","<<t.second<<")";}
template<typename T> ostream& operator<<(ostream &s,vector<T> t){F(i,0,SZ(t))s<<t[i]<<" ";return s; }

struct Reverse {
  bool operator()(int x, int y) {
    return y < x;
  }
};

int main()
{
// 	TESTS
	{
		// cout << "hello";
		vector < ii > cmd,ncmd;
		wez(n);
		// DBG(n);
		string str;
		int t;
		F(i,0,n)
		{
			cin >> str;
			if( str[0] == 'i' )
			{
				cin >> t;
				cmd.pb( mp(1,t) );
			}
			else if( str[0] == 'g' )
			{
				cin >> t;
				cmd.pb( mp(2,t) );
			}
			else
			{
				cmd.pb( mp(0,0) );
			}
		}
		// printV(cmd);

		priority_queue <int, vector<int>, Reverse> pq;
		F(i,0,n)
		{
			// cout << "yes"<< endl;
			if(cmd[i].first == 1)
			{
				pq.push(cmd[i].second);
				ncmd.pb(cmd[i]);
			}
			else if(cmd[i].first == 0)
			{
				if(pq.empty())
				{
					ncmd.pb( mp(1,1) );
				}
				else
					pq.pop();
				ncmd.pb(cmd[i]);
			}
			else
			{
				// DBG(pq.top());
				// DBG(cmd[i].second);
				if(pq.empty())
				{
					ncmd.pb( mp(1,cmd[i].second) );
					pq.push(cmd[i].second);
					ncmd.pb( cmd[i] );
				}
				else
				{
					if( cmd[i].second < pq.top() )
					{
						ncmd.pb( mp(1,cmd[i].second) );
						pq.push(cmd[i].second);
					}
					else if( cmd[i].second > pq.top() )
					{
						while( !pq.empty() && cmd[i].second > pq.top() )
						{
							ncmd.pb( mp(0,0) );
							pq.pop();
						}
						if( pq.empty() || cmd[i].second < pq.top() )
						{
							ncmd.pb( mp(1,cmd[i].second) );
							pq.push(cmd[i].second);
						}

					}
					ncmd.pb( cmd[i] );
				}

			}
// 			DBG(cmd[i]);
// 			DBG(pq.size());

			// printV(cmd);
			// printV(ncmd);
			// cout << endl;

		}

		cout << ncmd.size() << endl;
		F(i,0,ncmd.size())
		{
			if(ncmd[i].first == 0)
				cout << "removeMin\n";
			else if(ncmd[i].first == 1)
				cout << "insert " << ncmd[i].second << endl;
			else
				cout << "getMin " << ncmd[i].second << endl;
		}
	}
	return 0;
}


#include <cmath>
#include <climits>
#include <queue>
#include <vector>
#include <map>
#include <cstdlib>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <sstream>  // istringstream buffer(myString);
#include <stack>
#include <algorithm>
#include <cstring>
#include <cassert>
#include <functional>
using namespace std;
#define bit(x,i) (x&(1<<i))  //select the bit of position i of x
#define lowbit(x) ((x)&((x)^((x)-1))) //get the lowest bit of x
#define hBit(msb,n) asm("bsrl %1,%0" : "=r"(msb) : "r"(n)) //get the highest bit of x, maybe the fastest
#define max(a,b) (a<b?b:a)
#define abs(x) (x<0?(-x):x) // big bug here if "-x" is not surrounded by "()"
#define IN(i,l,r) (l<i&&i<r) //the next for are for checking bound
#define LINR(i,l,r) (l<=i&&i<=r)
#define LIN(i,l,r) (l<=i&&i<r)
#define INR(i,l,r) (l<i&&i<=r)
#define F(i,L,R) for (int i = L; i < R; i++) //next four are for "for loops"
#define FE(i,L,R) for (int i = L; i <= R; i++)
#define FF(i,L,R) for (int i = L; i > R; i--)
#define FFE(i,L,R) for (int i = L; i >= R; i--)
#define getI(a) scanf("%d", &a) //next three are handy ways to get ints, it's also force you to use '&' sign
#define getII(a,b) scanf("%d%d", &a, &b)
#define getIII(a,b,c) scanf("%d%d%d", &a, &b, &c)
#define wez(n) int (n); scanf("%d",&(n)) //handy if the input is right after the definition of a variable
#define wez2(n,m) int (n),(m); scanf("%d %d",&(n),&(m))
#define wez3(n,m,k) int (n),(m),(k); scanf("%d %d %d",&(n),&(m),&(k))
#define TESTS wez(testow);while(testow--) //for multilple cases problems
#define whileZ int T; getI(T); while(T--) // the same as above
#define getS(x) scanf("%s", x) //get a char* string
#define clr(a,x) memset(a,x,sizeof(a)) //set elements of array to some value
#define char2Int(c) (c-'0')
#define lastEle(vec) vec[vec.size()-1]
#define SZ(x) ((int)((x).size()))
#define REMAX(a,b) (a)=max((a),(b)) // set a to the maximum of a and b
#define REMIN(a,b) (a)=min((a),(b));
#define FOREACH(i,t) for (typeof(t.begin()) i=t.begin(); i!=t.end(); i++) // traverse an STL data structure
#define ALL(c) (c).begin(),(c).end() //handy for function like "sort()"
#define PRESENT(c,x) ((c).find(x) != (c).end())
#define CPRESENT(c,x) (find(ALL(c),x) != (c).end())
#define ll long long //data types used often, but you don't want to type them time by time
#define ull unsigned long long
#define ui unsigned int
#define us unsigned short
#define IOS ios_base::sync_with_stdio(0); //to synchronize the input of cin and scanf
#define INF 1001001001
#define PI 3.1415926535897932384626
//for map, pair
#define mp make_pair
#define fi first
#define se second
// for debug
inline void pisz(int n) { printf("%d\n",n); }
#define DBG(vari) cerr<<#vari<<" = "<<(vari)<<endl;
#define printA(a,L,R) FE(i,L,R) cout << a[i] << (i==R?'\n':' ')
#define printV(a) printA(a,0,a.size()-1)
#define MAXN 10000
//for vectors
#define pb push_back
typedef int elem_t;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> ii;
// directions
const int fx[4][2] = {{0,1}, {0,-1}, {1,0}, {-1,0}};
const int fxx[8][2] = {{0,1}, {0,-1}, {1,0}, {-1,0}, {1,1}, {1,-1}, {-1,1}, {-1,-1}};
template<typename T,typename TT> ostream& operator<<(ostream &s,pair<T,TT> t) {return s<<"("<<t.first<<","<<t.second<<")";}
template<typename T> ostream& operator<<(ostream &s,vector<T> t){F(i,0,SZ(t))s<<t[i]<<" ";return s; }

struct Reverse {
  bool operator()(int x, int y) {
    return y < x;
  }
};

int main()
{
	TESTS
	{
		// cout << "hello";
		vector < ii > cmd,ncmd;
		wez(n);
		// DBG(n);
		string str;
		int t;
		F(i,0,n)
		{
			cin >> str;
			if( str[0] == 'i' )
			{
				cin >> t;
				cmd.pb( mp(1,t) );
			}
			else if( str[0] == 'g' )
			{
				cin >> t;
				cmd.pb( mp(2,t) );
			}
			else
			{
				cmd.pb( mp(0,0) );
			}
		}
		// printV(cmd);

		priority_queue <int, vector<int>, Reverse> pq;
		F(i,0,n)
		{
			// cout << "yes"<< endl;
			if(cmd[i].first == 1)
			{
				pq.push(cmd[i].second);
				ncmd.pb(cmd[i]);
			}
			else if(cmd[i].first == 0)
			{
				if(pq.empty())
					ncmd.pb( mp(1,1) );
				else
					pq.pop();
				ncmd.pb(cmd[i]);
			}
			else
			{
				// DBG(pq.top());
				// DBG(cmd[i].second);
				if( cmd[i].second < pq.top() )
					ncmd.pb( mp(1,cmd[i].second) );

				else if( cmd[i].second > pq.top() )
				{
					while( !pq.empty() && cmd[i].second > pq.top() )
					{
						ncmd.pb( mp(0,0) );
						pq.pop();
					}
					if( pq.empty() || cmd[i].second < pq.top() )
						ncmd.pb( mp(1,cmd[i].second) );
				}
				ncmd.pb( mp(2,cmd[i].second) );
			}
			// printV(cmd);
			// printV(ncmd);
			// cout << endl;

		}

		cout << ncmd.size() << endl;
		F(i,0,ncmd.size())
		{
			if(ncmd[i].first == 0)
				cout << "removeMin\n";
			else if(ncmd[i].first == 1)
				cout << "insert " << ncmd[i].second << endl;
			else
				cout << "getMin " << ncmd[i].second << endl;
		}
	}
	return 0;
}


#include <cmath>
#include <climits>
#include <queue>
#include <vector>
#include <map>
#include <cstdlib>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <sstream>  // istringstream buffer(myString);
#include <stack>
#include <algorithm>
#include <cstring>
#include <cassert>
#include <functional>
using namespace std;
#define bit(x,i) (x&(1<<i))  //select the bit of position i of x
#define lowbit(x) ((x)&((x)^((x)-1))) //get the lowest bit of x
#define hBit(msb,n) asm("bsrl %1,%0" : "=r"(msb) : "r"(n)) //get the highest bit of x, maybe the fastest
#define max(a,b) (a<b?b:a)
#define abs(x) (x<0?(-x):x) // big bug here if "-x" is not surrounded by "()"
#define IN(i,l,r) (l<i&&i<r) //the next for are for checking bound
#define LINR(i,l,r) (l<=i&&i<=r)
#define LIN(i,l,r) (l<=i&&i<r)
#define INR(i,l,r) (l<i&&i<=r)
#define F(i,L,R) for (int i = L; i < R; i++) //next four are for "for loops"
#define FE(i,L,R) for (int i = L; i <= R; i++)
#define FF(i,L,R) for (int i = L; i > R; i--)
#define FFE(i,L,R) for (int i = L; i >= R; i--)
#define getI(a) scanf("%d", &a) //next three are handy ways to get ints, it's also force you to use '&' sign
#define getII(a,b) scanf("%d%d", &a, &b)
#define getIII(a,b,c) scanf("%d%d%d", &a, &b, &c)
#define wez(n) int (n); scanf("%d",&(n)) //handy if the input is right after the definition of a variable
#define wez2(n,m) int (n),(m); scanf("%d %d",&(n),&(m))
#define wez3(n,m,k) int (n),(m),(k); scanf("%d %d %d",&(n),&(m),&(k))
#define TESTS wez(testow);while(testow--) //for multilple cases problems
#define whileZ int T; getI(T); while(T--) // the same as above
#define getS(x) scanf("%s", x) //get a char* string
#define clr(a,x) memset(a,x,sizeof(a)) //set elements of array to some value
#define char2Int(c) (c-'0')
#define lastEle(vec) vec[vec.size()-1]
#define SZ(x) ((int)((x).size()))
#define REMAX(a,b) (a)=max((a),(b)) // set a to the maximum of a and b
#define REMIN(a,b) (a)=min((a),(b));
#define FOREACH(i,t) for (typeof(t.begin()) i=t.begin(); i!=t.end(); i++) // traverse an STL data structure
#define ALL(c) (c).begin(),(c).end() //handy for function like "sort()"
#define PRESENT(c,x) ((c).find(x) != (c).end())
#define CPRESENT(c,x) (find(ALL(c),x) != (c).end())
#define ll long long //data types used often, but you don't want to type them time by time
#define ull unsigned long long
#define ui unsigned int
#define us unsigned short
#define IOS ios_base::sync_with_stdio(0); //to synchronize the input of cin and scanf
#define INF 1001001001
#define PI 3.1415926535897932384626
//for map, pair
#define mp make_pair
#define fi first
#define se second
// for debug
inline void pisz(int n) { printf("%d\n",n); }
#define DBG(vari) cerr<<#vari<<" = "<<(vari)<<endl;
#define printA(a,L,R) FE(i,L,R) cout << a[i] << (i==R?'\n':' ')
#define printV(a) printA(a,0,a.size()-1)
#define MAXN 10000
//for vectors
#define pb push_back
typedef int elem_t;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> ii;
// directions
const int fx[4][2] = {{0,1}, {0,-1}, {1,0}, {-1,0}};
const int fxx[8][2] = {{0,1}, {0,-1}, {1,0}, {-1,0}, {1,1}, {1,-1}, {-1,1}, {-1,-1}};
template<typename T,typename TT> ostream& operator<<(ostream &s,pair<T,TT> t) {return s<<"("<<t.first<<","<<t.second<<")";}
template<typename T> ostream& operator<<(ostream &s,vector<T> t){F(i,0,SZ(t))s<<t[i]<<" ";return s; }

struct Reverse {
  bool operator()(int x, int y) {
    return y < x;
  }
};

int main()
{
	TESTS
	{
		// cout << "hello";
		vector < ii > cmd,ncmd;
		wez(n);
		// DBG(n);
		string str;
		int t;
		F(i,0,n)
		{
			cin >> str;
			if( str[0] == 'i' )
			{
				cin >> t;
				cmd.pb( mp(1,t) );
			}
			else if( str[0] == 'g' )
			{
				cin >> t;
				cmd.pb( mp(2,t) );
			}
			else
			{
				cmd.pb( mp(0,0) );
			}
		}
		// printV(cmd);

		priority_queue <int, vector<int>, Reverse> pq;
		F(i,0,n)
		{
			// cout << "yes"<< endl;
			if(cmd[i].first == 1)
			{
				pq.push(cmd[i].second);
				ncmd.pb(cmd[i]);
			}
			else if(cmd[i].first == 0)
			{
				if(pq.empty())
				{
					ncmd.pb( mp(1,1) );
				}
				else
					pq.pop();
				ncmd.pb(cmd[i]);
			}
			else
			{
				// DBG(pq.top());
				// DBG(cmd[i].second);
				if(pq.empty())
				{
					ncmd.pb( mp(1,cmd[i].second) );
					pq.push(cmd[i].second);
					ncmd.pb( cmd[i] );
				}
				else
				{
					if( cmd[i].second < pq.top() )
						ncmd.pb( mp(1,cmd[i].second) );
					else if( cmd[i].second > pq.top() )
					{
						while( !pq.empty() && cmd[i].second > pq.top() )
						{
							ncmd.pb( mp(0,0) );
							pq.pop();
						}
						if( pq.empty() || cmd[i].second < pq.top() )
						{
							ncmd.pb( mp(1,cmd[i].second) );
							pq.push(cmd[i].second);
						}

					}
					ncmd.pb( cmd[i] );
				}

			}
			// DBG(cmd[i]);
			// DBG(pq.size());

			// printV(cmd);
			// printV(ncmd);
			// cout << endl;

		}

		cout << ncmd.size() << endl;
		F(i,0,ncmd.size())
		{
			if(ncmd[i].first == 0)
				cout << "removeMin\n";
			else if(ncmd[i].first == 1)
				cout << "insert " << ncmd[i].second << endl;
			else
				cout << "getMin " << ncmd[i].second << endl;
		}
	}
	return 0;
}


#include <cmath>
#include <climits>
#include <queue>
#include <vector>
#include <map>
#include <cstdlib>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <sstream>  // istringstream buffer(myString);
#include <stack>
#include <algorithm>
#include <cstring>
#include <cassert>
#include <functional>
using namespace std;
#define bit(x,i) (x&(1<<i))  //select the bit of position i of x
#define lowbit(x) ((x)&((x)^((x)-1))) //get the lowest bit of x
#define hBit(msb,n) asm("bsrl %1,%0" : "=r"(msb) : "r"(n)) //get the highest bit of x, maybe the fastest
#define max(a,b) (a<b?b:a)
#define abs(x) (x<0?(-x):x) // big bug here if "-x" is not surrounded by "()"
#define IN(i,l,r) (l<i&&i<r) //the next for are for checking bound
#define LINR(i,l,r) (l<=i&&i<=r)
#define LIN(i,l,r) (l<=i&&i<r)
#define INR(i,l,r) (l<i&&i<=r)
#define F(i,L,R) for (int i = L; i < R; i++) //next four are for "for loops"
#define FE(i,L,R) for (int i = L; i <= R; i++)
#define FF(i,L,R) for (int i = L; i > R; i--)
#define FFE(i,L,R) for (int i = L; i >= R; i--)
#define getI(a) scanf("%d", &a) //next three are handy ways to get ints, it's also force you to use '&' sign
#define getII(a,b) scanf("%d%d", &a, &b)
#define getIII(a,b,c) scanf("%d%d%d", &a, &b, &c)
#define wez(n) int (n); scanf("%d",&(n)) //handy if the input is right after the definition of a variable
#define wez2(n,m) int (n),(m); scanf("%d %d",&(n),&(m))
#define wez3(n,m,k) int (n),(m),(k); scanf("%d %d %d",&(n),&(m),&(k))
#define TESTS wez(testow);while(testow--) //for multilple cases problems
#define whileZ int T; getI(T); while(T--) // the same as above
#define getS(x) scanf("%s", x) //get a char* string
#define clr(a,x) memset(a,x,sizeof(a)) //set elements of array to some value
#define char2Int(c) (c-'0')
#define lastEle(vec) vec[vec.size()-1]
#define SZ(x) ((int)((x).size()))
#define REMAX(a,b) (a)=max((a),(b)) // set a to the maximum of a and b
#define REMIN(a,b) (a)=min((a),(b));
#define FOREACH(i,t) for (typeof(t.begin()) i=t.begin(); i!=t.end(); i++) // traverse an STL data structure
#define ALL(c) (c).begin(),(c).end() //handy for function like "sort()"
#define PRESENT(c,x) ((c).find(x) != (c).end())
#define CPRESENT(c,x) (find(ALL(c),x) != (c).end())
#define ll long long //data types used often, but you don't want to type them time by time
#define ull unsigned long long
#define ui unsigned int
#define us unsigned short
#define IOS ios_base::sync_with_stdio(0); //to synchronize the input of cin and scanf
#define INF 1001001001
#define PI 3.1415926535897932384626
//for map, pair
#define mp make_pair
#define fi first
#define se second
// for debug
inline void pisz(int n) { printf("%d\n",n); }
#define DBG(vari) cerr<<#vari<<" = "<<(vari)<<endl;
#define printA(a,L,R) FE(i,L,R) cout << a[i] << (i==R?'\n':' ')
#define printV(a) printA(a,0,a.size()-1)
#define MAXN 10000
//for vectors
#define pb push_back
typedef int elem_t;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> ii;
// directions
const int fx[4][2] = {{0,1}, {0,-1}, {1,0}, {-1,0}};
const int fxx[8][2] = {{0,1}, {0,-1}, {1,0}, {-1,0}, {1,1}, {1,-1}, {-1,1}, {-1,-1}};
template<typename T,typename TT> ostream& operator<<(ostream &s,pair<T,TT> t) {return s<<"("<<t.first<<","<<t.second<<")";}
template<typename T> ostream& operator<<(ostream &s,vector<T> t){F(i,0,SZ(t))s<<t[i]<<" ";return s; }

struct Reverse {
  bool operator()(int x, int y) {
    return y < x;
  }
};

int main()
{
	// TESTS
	{
		// cout << "hello";
		vector < ii > cmd,ncmd;
		wez(n);
		// DBG(n);
		string str;
		int t;
		F(i,0,n)
		{
			cin >> str;
			if( str[0] == 'i' )
			{
				cin >> t;
				cmd.pb( mp(1,t) );
			}
			else if( str[0] == 'g' )
			{
				cin >> t;
				cmd.pb( mp(2,t) );
			}
			else
			{
				cmd.pb( mp(0,0) );
			}
		}
		// printV(cmd);

		priority_queue <int, vector<int>, Reverse> pq;
		F(i,0,n)
		{
			// cout << "yes"<< endl;
			if(cmd[i].first == 1)
			{
				pq.push(cmd[i].second);
				ncmd.pb(cmd[i]);
			}
			else if(cmd[i].first == 0)
			{
				if(pq.empty())
					ncmd.pb( mp(1,1) );
				else
					pq.pop();
				ncmd.pb(cmd[i]);
			}
			else
			{
				// DBG(pq.top());
				// DBG(cmd[i].second);
				if( cmd[i].second < pq.top() )
					ncmd.pb( mp(1,cmd[i].second) );

				else if( cmd[i].second > pq.top() )
				{
					while( !pq.empty() && cmd[i].second > pq.top() )
					{
						ncmd.pb( mp(0,0) );
						pq.pop();
					}
					if( pq.empty() || cmd[i].second < pq.top() )
						ncmd.pb( mp(1,cmd[i].second) );
				}
				ncmd.pb( mp(2,cmd[i].second) );
			}
			// printV(cmd);
			// printV(ncmd);
			// cout << endl;

		}

		cout << ncmd.size() << endl;
		F(i,0,ncmd.size())
		{
			if(ncmd[i].first == 0)
				cout << "removeMin\n";
			else if(ncmd[i].first == 1)
				cout << "insert " << ncmd[i].second << endl;
			else
				cout << "getMin " << ncmd[i].second << endl;
		}
	}
	return 0;
}


#include <cmath>
#include <climits>
#include <queue>
#include <vector>
#include <map>
#include <cstdlib>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <sstream>  // istringstream buffer(myString);
#include <stack>
#include <algorithm>
#include <cstring>
#include <cassert>
#include <functional>
using namespace std;
#define bit(x,i) (x&(1<<i))  //select the bit of position i of x
#define lowbit(x) ((x)&((x)^((x)-1))) //get the lowest bit of x
#define hBit(msb,n) asm("bsrl %1,%0" : "=r"(msb) : "r"(n)) //get the highest bit of x, maybe the fastest
#define max(a,b) (a<b?b:a)
#define abs(x) (x<0?(-x):x) // big bug here if "-x" is not surrounded by "()"
#define IN(i,l,r) (l<i&&i<r) //the next for are for checking bound
#define LINR(i,l,r) (l<=i&&i<=r)
#define LIN(i,l,r) (l<=i&&i<r)
#define INR(i,l,r) (l<i&&i<=r)
#define F(i,L,R) for (int i = L; i < R; i++) //next four are for "for loops"
#define FE(i,L,R) for (int i = L; i <= R; i++)
#define FF(i,L,R) for (int i = L; i > R; i--)
#define FFE(i,L,R) for (int i = L; i >= R; i--)
#define getI(a) scanf("%d", &a) //next three are handy ways to get ints, it's also force you to use '&' sign
#define getII(a,b) scanf("%d%d", &a, &b)
#define getIII(a,b,c) scanf("%d%d%d", &a, &b, &c)
#define wez(n) int (n); scanf("%d",&(n)) //handy if the input is right after the definition of a variable
#define wez2(n,m) int (n),(m); scanf("%d %d",&(n),&(m))
#define wez3(n,m,k) int (n),(m),(k); scanf("%d %d %d",&(n),&(m),&(k))
#define TESTS wez(testow);while(testow--) //for multilple cases problems
#define whileZ int T; getI(T); while(T--) // the same as above
#define getS(x) scanf("%s", x) //get a char* string
#define clr(a,x) memset(a,x,sizeof(a)) //set elements of array to some value
#define char2Int(c) (c-'0')
#define lastEle(vec) vec[vec.size()-1]
#define SZ(x) ((int)((x).size()))
#define REMAX(a,b) (a)=max((a),(b)) // set a to the maximum of a and b
#define REMIN(a,b) (a)=min((a),(b));
#define FOREACH(i,t) for (typeof(t.begin()) i=t.begin(); i!=t.end(); i++) // traverse an STL data structure
#define ALL(c) (c).begin(),(c).end() //handy for function like "sort()"
#define PRESENT(c,x) ((c).find(x) != (c).end())
#define CPRESENT(c,x) (find(ALL(c),x) != (c).end())
#define ll long long //data types used often, but you don't want to type them time by time
#define ull unsigned long long
#define ui unsigned int
#define us unsigned short
#define IOS ios_base::sync_with_stdio(0); //to synchronize the input of cin and scanf
#define INF 1001001001
#define PI 3.1415926535897932384626
//for map, pair
#define mp make_pair
#define fi first
#define se second
// for debug
inline void pisz(int n) { printf("%d\n",n); }
#define DBG(vari) cerr<<#vari<<" = "<<(vari)<<endl;
#define printA(a,L,R) FE(i,L,R) cout << a[i] << (i==R?'\n':' ')
#define printV(a) printA(a,0,a.size()-1)
#define MAXN 10000
//for vectors
#define pb push_back
typedef int elem_t;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> ii;
// directions
const int fx[4][2] = {{0,1}, {0,-1}, {1,0}, {-1,0}};
const int fxx[8][2] = {{0,1}, {0,-1}, {1,0}, {-1,0}, {1,1}, {1,-1}, {-1,1}, {-1,-1}};
template<typename T,typename TT> ostream& operator<<(ostream &s,pair<T,TT> t) {return s<<"("<<t.first<<","<<t.second<<")";}
template<typename T> ostream& operator<<(ostream &s,vector<T> t){F(i,0,SZ(t))s<<t[i]<<" ";return s; }

struct Reverse {
  bool operator()(int x, int y) {
    return y < x;
  }
};

int main()
{
	// TESTS
	{
		// cout << "hello";
		vector < ii > cmd,ncmd;
		wez(n);
		// DBG(n);
		string str;
		int t;
		F(i,0,n)
		{
			cin >> str;
			if( str[0] == 'i' )
			{
				cin >> t;
				cmd.pb( mp(1,t) );
			}
			else if( str[0] == 'g' )
			{
				cin >> t;
				cmd.pb( mp(2,t) );
			}
			else
			{
				cmd.pb( mp(0,0) );
			}
		}
		// printV(cmd);

		priority_queue <int, vector<int>, Reverse> pq;
		F(i,0,n)
		{
			// cout << "yes"<< endl;
			if(cmd[i].first == 1)
			{
				pq.push(cmd[i].second);
				ncmd.pb(cmd[i]);
			}
			else if(cmd[i].first == 0)
			{
				if(pq.empty())
					ncmd.pb( mp(1,1) );
				else
					pq.pop();
				ncmd.pb(cmd[i]);
			}
			else
			{
				// DBG(pq.top());
				// DBG(cmd[i].second);
				if(pq.empty())
				{
					ncmd.pb( mp(1,cmd[i].second) );
					pq.push(cmd[i].second);
					ncmd.pb( cmd[i] );
				}
				else
				{
					if( cmd[i].second < pq.top() )
						ncmd.pb( mp(1,cmd[i].second) );
					else if( cmd[i].second > pq.top() )
					{
						while( !pq.empty() && cmd[i].second > pq.top() )
						{
							ncmd.pb( mp(0,0) );
							pq.pop();
						}
						if( pq.empty() || cmd[i].second < pq.top() )
							ncmd.pb( mp(1,cmd[i].second) );
					}
					ncmd.pb( cmd[i] );
				}

			}
			// printV(cmd);
			// printV(ncmd);
			// cout << endl;

		}

		cout << ncmd.size() << endl;
		F(i,0,ncmd.size())
		{
			if(ncmd[i].first == 0)
				cout << "removeMin\n";
			else if(ncmd[i].first == 1)
				cout << "insert " << ncmd[i].second << endl;
			else
				cout << "getMin " << ncmd[i].second << endl;
		}
	}
	return 0;
}


#include <cmath>
#include <climits>
#include <queue>
#include <vector>
#include <map>
#include <cstdlib>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <sstream>  // istringstream buffer(myString);
#include <stack>
#include <algorithm>
#include <cstring>
#include <cassert>
#include <functional>
using namespace std;
#define bit(x,i) (x&(1<<i))  //select the bit of position i of x
#define lowbit(x) ((x)&((x)^((x)-1))) //get the lowest bit of x
#define hBit(msb,n) asm("bsrl %1,%0" : "=r"(msb) : "r"(n)) //get the highest bit of x, maybe the fastest
#define max(a,b) (a<b?b:a)
#define abs(x) (x<0?(-x):x) // big bug here if "-x" is not surrounded by "()"
#define IN(i,l,r) (l<i&&i<r) //the next for are for checking bound
#define LINR(i,l,r) (l<=i&&i<=r)
#define LIN(i,l,r) (l<=i&&i<r)
#define INR(i,l,r) (l<i&&i<=r)
#define F(i,L,R) for (int i = L; i < R; i++) //next four are for "for loops"
#define FE(i,L,R) for (int i = L; i <= R; i++)
#define FF(i,L,R) for (int i = L; i > R; i--)
#define FFE(i,L,R) for (int i = L; i >= R; i--)
#define getI(a) scanf("%d", &a) //next three are handy ways to get ints, it's also force you to use '&' sign
#define getII(a,b) scanf("%d%d", &a, &b)
#define getIII(a,b,c) scanf("%d%d%d", &a, &b, &c)
#define wez(n) int (n); scanf("%d",&(n)) //handy if the input is right after the definition of a variable
#define wez2(n,m) int (n),(m); scanf("%d %d",&(n),&(m))
#define wez3(n,m,k) int (n),(m),(k); scanf("%d %d %d",&(n),&(m),&(k))
#define TESTS wez(testow);while(testow--) //for multilple cases problems
#define whileZ int T; getI(T); while(T--) // the same as above
#define getS(x) scanf("%s", x) //get a char* string
#define clr(a,x) memset(a,x,sizeof(a)) //set elements of array to some value
#define char2Int(c) (c-'0')
#define lastEle(vec) vec[vec.size()-1]
#define SZ(x) ((int)((x).size()))
#define REMAX(a,b) (a)=max((a),(b)) // set a to the maximum of a and b
#define REMIN(a,b) (a)=min((a),(b));
#define FOREACH(i,t) for (typeof(t.begin()) i=t.begin(); i!=t.end(); i++) // traverse an STL data structure
#define ALL(c) (c).begin(),(c).end() //handy for function like "sort()"
#define PRESENT(c,x) ((c).find(x) != (c).end())
#define CPRESENT(c,x) (find(ALL(c),x) != (c).end())
#define ll long long //data types used often, but you don't want to type them time by time
#define ull unsigned long long
#define ui unsigned int
#define us unsigned short
#define IOS ios_base::sync_with_stdio(0); //to synchronize the input of cin and scanf
#define INF 1001001001
#define PI 3.1415926535897932384626
//for map, pair
#define mp make_pair
#define fi first
#define se second
// for debug
inline void pisz(int n) { printf("%d\n",n); }
#define DBG(vari) cerr<<#vari<<" = "<<(vari)<<endl;
#define printA(a,L,R) FE(i,L,R) cout << a[i] << (i==R?'\n':' ')
#define printV(a) printA(a,0,a.size()-1)
#define MAXN 10000
//for vectors
#define pb push_back
typedef int elem_t;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> ii;
// directions
const int fx[4][2] = {{0,1}, {0,-1}, {1,0}, {-1,0}};
const int fxx[8][2] = {{0,1}, {0,-1}, {1,0}, {-1,0}, {1,1}, {1,-1}, {-1,1}, {-1,-1}};
template<typename T,typename TT> ostream& operator<<(ostream &s,pair<T,TT> t) {return s<<"("<<t.first<<","<<t.second<<")";}
template<typename T> ostream& operator<<(ostream &s,vector<T> t){F(i,0,SZ(t))s<<t[i]<<" ";return s; }

struct Reverse {
  bool operator()(int x, int y) {
    return y < x;
  }
};

int main()
{
// 	TESTS
	{
		// cout << "hello";
		vector < ii > cmd,ncmd;
		wez(n);
		// DBG(n);
		string str;
		int t;
		F(i,0,n)
		{
			cin >> str;
			if( str[0] == 'i' )
			{
				cin >> t;
				cmd.pb( mp(1,t) );
			}
			else if( str[0] == 'g' )
			{
				cin >> t;
				cmd.pb( mp(2,t) );
			}
			else
			{
				cmd.pb( mp(0,0) );
			}
		}
		// printV(cmd);

		priority_queue <int, vector<int>, Reverse> pq;
		F(i,0,n)
		{
			// cout << "yes"<< endl;
			if(cmd[i].first == 1)
			{
				pq.push(cmd[i].second);
				ncmd.pb(cmd[i]);
			}
			else if(cmd[i].first == 0)
			{
				if(pq.empty())
				{
					ncmd.pb( mp(1,1) );
				}
				else
					pq.pop();
				ncmd.pb(cmd[i]);
			}
			else
			{
				// DBG(pq.top());
				// DBG(cmd[i].second);
				if(pq.empty())
				{
					ncmd.pb( mp(1,cmd[i].second) );
					pq.push(cmd[i].second);
					ncmd.pb( cmd[i] );
				}
				else
				{
					if( cmd[i].second < pq.top() )
						ncmd.pb( mp(1,cmd[i].second) );
					else if( cmd[i].second > pq.top() )
					{
						while( !pq.empty() && cmd[i].second > pq.top() )
						{
							ncmd.pb( mp(0,0) );
							pq.pop();
						}
						if( pq.empty() || cmd[i].second < pq.top() )
						{
							ncmd.pb( mp(1,cmd[i].second) );
							pq.push(cmd[i].second);
						}

					}
					ncmd.pb( cmd[i] );
				}

			}
			// DBG(cmd[i]);
			// DBG(pq.size());

			// printV(cmd);
			// printV(ncmd);
			// cout << endl;

		}

		cout << ncmd.size() << endl;
		F(i,0,ncmd.size())
		{
			if(ncmd[i].first == 0)
				cout << "removeMin\n";
			else if(ncmd[i].first == 1)
				cout << "insert " << ncmd[i].second << endl;
			else
				cout << "getMin " << ncmd[i].second << endl;
		}
	}
	return 0;
}


#include <cmath>
#include <climits>
#include <queue>
#include <vector>
#include <map>
#include <cstdlib>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <sstream>  // istringstream buffer(myString);
#include <stack>
#include <algorithm>
#include <cstring>
#include <cassert>
#include <functional>
using namespace std;
#define bit(x,i) (x&(1<<i))  //select the bit of position i of x
#define lowbit(x) ((x)&((x)^((x)-1))) //get the lowest bit of x
#define hBit(msb,n) asm("bsrl %1,%0" : "=r"(msb) : "r"(n)) //get the highest bit of x, maybe the fastest
#define max(a,b) (a<b?b:a)
#define abs(x) (x<0?(-x):x) // big bug here if "-x" is not surrounded by "()"
#define IN(i,l,r) (l<i&&i<r) //the next for are for checking bound
#define LINR(i,l,r) (l<=i&&i<=r)
#define LIN(i,l,r) (l<=i&&i<r)
#define INR(i,l,r) (l<i&&i<=r)
#define F(i,L,R) for (int i = L; i < R; i++) //next four are for "for loops"
#define FE(i,L,R) for (int i = L; i <= R; i++)
#define FF(i,L,R) for (int i = L; i > R; i--)
#define FFE(i,L,R) for (int i = L; i >= R; i--)
#define getI(a) scanf("%d", &a) //next three are handy ways to get ints, it's also force you to use '&' sign
#define getII(a,b) scanf("%d%d", &a, &b)
#define getIII(a,b,c) scanf("%d%d%d", &a, &b, &c)
#define wez(n) int (n); scanf("%d",&(n)) //handy if the input is right after the definition of a variable
#define wez2(n,m) int (n),(m); scanf("%d %d",&(n),&(m))
#define wez3(n,m,k) int (n),(m),(k); scanf("%d %d %d",&(n),&(m),&(k))
#define TESTS wez(testow);while(testow--) //for multilple cases problems
#define whileZ int T; getI(T); while(T--) // the same as above
#define getS(x) scanf("%s", x) //get a char* string
#define clr(a,x) memset(a,x,sizeof(a)) //set elements of array to some value
#define char2Int(c) (c-'0')
#define lastEle(vec) vec[vec.size()-1]
#define SZ(x) ((int)((x).size()))
#define REMAX(a,b) (a)=max((a),(b)) // set a to the maximum of a and b
#define REMIN(a,b) (a)=min((a),(b));
#define FOREACH(i,t) for (typeof(t.begin()) i=t.begin(); i!=t.end(); i++) // traverse an STL data structure
#define ALL(c) (c).begin(),(c).end() //handy for function like "sort()"
#define PRESENT(c,x) ((c).find(x) != (c).end())
#define CPRESENT(c,x) (find(ALL(c),x) != (c).end())
#define ll long long //data types used often, but you don't want to type them time by time
#define ull unsigned long long
#define ui unsigned int
#define us unsigned short
#define IOS ios_base::sync_with_stdio(0); //to synchronize the input of cin and scanf
#define INF 1001001001
#define PI 3.1415926535897932384626
//for map, pair
#define mp make_pair
#define fi first
#define se second
// for debug
inline void pisz(int n) { printf("%d\n",n); }
#define DBG(vari) cerr<<#vari<<" = "<<(vari)<<endl;
#define printA(a,L,R) FE(i,L,R) cout << a[i] << (i==R?'\n':' ')
#define printV(a) printA(a,0,a.size()-1)
#define MAXN 10000
//for vectors
#define pb push_back
typedef int elem_t;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> ii;
// directions
const int fx[4][2] = {{0,1}, {0,-1}, {1,0}, {-1,0}};
const int fxx[8][2] = {{0,1}, {0,-1}, {1,0}, {-1,0}, {1,1}, {1,-1}, {-1,1}, {-1,-1}};
template<typename T,typename TT> ostream& operator<<(ostream &s,pair<T,TT> t) {return s<<"("<<t.first<<","<<t.second<<")";}
template<typename T> ostream& operator<<(ostream &s,vector<T> t){F(i,0,SZ(t))s<<t[i]<<" ";return s; }

struct Reverse {
  bool operator()(int x, int y) {
    return y < x;
  }
};

int main()
{
	// TESTS
	{
		// cout << "hello";
		vector < ii > cmd,ncmd;
		wez(n);
		// DBG(n);
		string str;
		int t;
		F(i,0,n)
		{
			cin >> str;
			if( str[0] == 'i' )
			{
				cin >> t;
				cmd.pb( mp(1,t) );
			}
			else if( str[0] == 'g' )
			{
				cin >> t;
				cmd.pb( mp(2,t) );
			}
			else
			{
				cmd.pb( mp(0,0) );
			}
		}
		// printV(cmd);

		priority_queue <int, vector<int>, Reverse> pq;
		F(i,0,n)
		{
			// cout << "yes"<< endl;
			if(cmd[i].first == 1)
			{
				pq.push(cmd[i].second);
				ncmd.pb(cmd[i]);
			}
			else if(cmd[i].first == 0)
			{
				if(pq.empty())
					ncmd.pb( mp(1,1) );
				else
					pq.pop();
				ncmd.pb(cmd[i]);
			}
			else
			{
				// DBG(pq.top());
				// DBG(cmd[i].second);
				if(pq.empty())
				{
					ncmd.pb( mp(1,cmd[i].second) );
					ncmd.pb( cmd[i] );
				}
				else
				{
					if( cmd[i].second < pq.top() )
						ncmd.pb( mp(1,cmd[i].second) );
					else if( cmd[i].second > pq.top() )
					{
						while( !pq.empty() && cmd[i].second > pq.top() )
						{
							ncmd.pb( mp(0,0) );
							pq.pop();
						}
						if( pq.empty() || cmd[i].second < pq.top() )
							ncmd.pb( mp(1,cmd[i].second) );
					}
					ncmd.pb( cmd[i] );
				}

			}
			// printV(cmd);
			// printV(ncmd);
			// cout << endl;

		}

		cout << ncmd.size() << endl;
		F(i,0,ncmd.size())
		{
			if(ncmd[i].first == 0)
				cout << "removeMin\n";
			else if(ncmd[i].first == 1)
				cout << "insert " << ncmd[i].second << endl;
			else
				cout << "getMin " << ncmd[i].second << endl;
		}
	}
	return 0;
}


#include <cmath>
#include <climits>
#include <queue>
#include <vector>
#include <map>
#include <cstdlib>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <sstream>  // istringstream buffer(myString);
#include <stack>
#include <algorithm>
#include <cstring>
#include <cassert>
#include <functional>
using namespace std;
#define bit(x,i) (x&(1<<i))  //select the bit of position i of x
#define lowbit(x) ((x)&((x)^((x)-1))) //get the lowest bit of x
#define hBit(msb,n) asm("bsrl %1,%0" : "=r"(msb) : "r"(n)) //get the highest bit of x, maybe the fastest
#define max(a,b) (a<b?b:a)
#define abs(x) (x<0?(-x):x) // big bug here if "-x" is not surrounded by "()"
#define IN(i,l,r) (l<i&&i<r) //the next for are for checking bound
#define LINR(i,l,r) (l<=i&&i<=r)
#define LIN(i,l,r) (l<=i&&i<r)
#define INR(i,l,r) (l<i&&i<=r)
#define F(i,L,R) for (int i = L; i < R; i++) //next four are for "for loops"
#define FE(i,L,R) for (int i = L; i <= R; i++)
#define FF(i,L,R) for (int i = L; i > R; i--)
#define FFE(i,L,R) for (int i = L; i >= R; i--)
#define getI(a) scanf("%d", &a) //next three are handy ways to get ints, it's also force you to use '&' sign
#define getII(a,b) scanf("%d%d", &a, &b)
#define getIII(a,b,c) scanf("%d%d%d", &a, &b, &c)
#define wez(n) int (n); scanf("%d",&(n)) //handy if the input is right after the definition of a variable
#define wez2(n,m) int (n),(m); scanf("%d %d",&(n),&(m))
#define wez3(n,m,k) int (n),(m),(k); scanf("%d %d %d",&(n),&(m),&(k))
#define TESTS wez(testow);while(testow--) //for multilple cases problems
#define whileZ int T; getI(T); while(T--) // the same as above
#define getS(x) scanf("%s", x) //get a char* string
#define clr(a,x) memset(a,x,sizeof(a)) //set elements of array to some value
#define char2Int(c) (c-'0')
#define lastEle(vec) vec[vec.size()-1]
#define SZ(x) ((int)((x).size()))
#define REMAX(a,b) (a)=max((a),(b)) // set a to the maximum of a and b
#define REMIN(a,b) (a)=min((a),(b));
#define FOREACH(i,t) for (typeof(t.begin()) i=t.begin(); i!=t.end(); i++) // traverse an STL data structure
#define ALL(c) (c).begin(),(c).end() //handy for function like "sort()"
#define PRESENT(c,x) ((c).find(x) != (c).end())
#define CPRESENT(c,x) (find(ALL(c),x) != (c).end())
#define ll long long //data types used often, but you don't want to type them time by time
#define ull unsigned long long
#define ui unsigned int
#define us unsigned short
#define IOS ios_base::sync_with_stdio(0); //to synchronize the input of cin and scanf
#define INF 1001001001
#define PI 3.1415926535897932384626
//for map, pair
#define mp make_pair
#define fi first
#define se second
// for debug
inline void pisz(int n) { printf("%d\n",n); }
#define DBG(vari) cerr<<#vari<<" = "<<(vari)<<endl;
#define printA(a,L,R) FE(i,L,R) cout << a[i] << (i==R?'\n':' ')
#define printV(a) printA(a,0,a.size()-1)
#define MAXN 10000
//for vectors
#define pb push_back
typedef int elem_t;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> ii;
// directions
const int fx[4][2] = {{0,1}, {0,-1}, {1,0}, {-1,0}};
const int fxx[8][2] = {{0,1}, {0,-1}, {1,0}, {-1,0}, {1,1}, {1,-1}, {-1,1}, {-1,-1}};
template<typename T,typename TT> ostream& operator<<(ostream &s,pair<T,TT> t) {return s<<"("<<t.first<<","<<t.second<<")";}
template<typename T> ostream& operator<<(ostream &s,vector<T> t){F(i,0,SZ(t))s<<t[i]<<" ";return s; }

struct Reverse {
  bool operator()(int x, int y) {
    return y < x;
  }
};

int main()
{
	TESTS
	{
		// cout << "hello";
		vector < ii > cmd,ncmd;
		wez(n);
		// DBG(n);
		string str;
		int t;
		F(i,0,n)
		{
			cin >> str;
			if( str[0] == 'i' )
			{
				cin >> t;
				cmd.pb( mp(1,t) );
			}
			else if( str[0] == 'g' )
			{
				cin >> t;
				cmd.pb( mp(2,t) );
			}
			else
			{
				cmd.pb( mp(0,0) );
			}
		}
		// printV(cmd);

		priority_queue <int, vector<int>, Reverse> pq;
		F(i,0,n)
		{
			// cout << "yes"<< endl;
			if(cmd[i].first == 1)
			{
				pq.push(cmd[i].second);
				ncmd.pb(cmd[i]);
			}
			else if(cmd[i].first == 0)
			{
				if(pq.empty())
				{
					ncmd.pb( mp(1,1) );
				}
				else
					pq.pop();
				ncmd.pb(cmd[i]);
			}
			else
			{
				// DBG(pq.top());
				// DBG(cmd[i].second);
				if(pq.empty())
				{
					ncmd.pb( mp(1,cmd[i].second) );
					pq.push(cmd[i].second);
					ncmd.pb( cmd[i] );
				}
				else
				{
					if( cmd[i].second < pq.top() )
						ncmd.pb( mp(1,cmd[i].second) );
					else if( cmd[i].second > pq.top() )
					{
						while( !pq.empty() && cmd[i].second > pq.top() )
						{
							ncmd.pb( mp(0,0) );
							pq.pop();
						}
						if( pq.empty() || cmd[i].second < pq.top() )
						{
							ncmd.pb( mp(1,cmd[i].second) );
							pq.push(cmd[i].second);
						}

					}
					ncmd.pb( cmd[i] );
				}

			}
			DBG(cmd[i]);
			DBG(pq.size());

			// printV(cmd);
			// printV(ncmd);
			// cout << endl;

		}

		cout << ncmd.size() << endl;
		F(i,0,ncmd.size())
		{
			if(ncmd[i].first == 0)
				cout << "removeMin\n";
			else if(ncmd[i].first == 1)
				cout << "insert " << ncmd[i].second << endl;
			else
				cout << "getMin " << ncmd[i].second << endl;
		}
	}
	return 0;
}


#include <cmath>
#include <climits>
#include <queue>
#include <vector>
#include <map>
#include <cstdlib>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <sstream>  // istringstream buffer(myString);
#include <stack>
#include <algorithm>
#include <cstring>
#include <cassert>
#include <functional>
using namespace std;
#define bit(x,i) (x&(1<<i))  //select the bit of position i of x
#define lowbit(x) ((x)&((x)^((x)-1))) //get the lowest bit of x
#define hBit(msb,n) asm("bsrl %1,%0" : "=r"(msb) : "r"(n)) //get the highest bit of x, maybe the fastest
#define max(a,b) (a<b?b:a)
#define abs(x) (x<0?(-x):x) // big bug here if "-x" is not surrounded by "()"
#define IN(i,l,r) (l<i&&i<r) //the next for are for checking bound
#define LINR(i,l,r) (l<=i&&i<=r)
#define LIN(i,l,r) (l<=i&&i<r)
#define INR(i,l,r) (l<i&&i<=r)
#define F(i,L,R) for (int i = L; i < R; i++) //next four are for "for loops"
#define FE(i,L,R) for (int i = L; i <= R; i++)
#define FF(i,L,R) for (int i = L; i > R; i--)
#define FFE(i,L,R) for (int i = L; i >= R; i--)
#define getI(a) scanf("%d", &a) //next three are handy ways to get ints, it's also force you to use '&' sign
#define getII(a,b) scanf("%d%d", &a, &b)
#define getIII(a,b,c) scanf("%d%d%d", &a, &b, &c)
#define wez(n) int (n); scanf("%d",&(n)) //handy if the input is right after the definition of a variable
#define wez2(n,m) int (n),(m); scanf("%d %d",&(n),&(m))
#define wez3(n,m,k) int (n),(m),(k); scanf("%d %d %d",&(n),&(m),&(k))
#define TESTS wez(testow);while(testow--) //for multilple cases problems
#define whileZ int T; getI(T); while(T--) // the same as above
#define getS(x) scanf("%s", x) //get a char* string
#define clr(a,x) memset(a,x,sizeof(a)) //set elements of array to some value
#define char2Int(c) (c-'0')
#define lastEle(vec) vec[vec.size()-1]
#define SZ(x) ((int)((x).size()))
#define REMAX(a,b) (a)=max((a),(b)) // set a to the maximum of a and b
#define REMIN(a,b) (a)=min((a),(b));
#define FOREACH(i,t) for (typeof(t.begin()) i=t.begin(); i!=t.end(); i++) // traverse an STL data structure
#define ALL(c) (c).begin(),(c).end() //handy for function like "sort()"
#define PRESENT(c,x) ((c).find(x) != (c).end())
#define CPRESENT(c,x) (find(ALL(c),x) != (c).end())
#define ll long long //data types used often, but you don't want to type them time by time
#define ull unsigned long long
#define ui unsigned int
#define us unsigned short
#define IOS ios_base::sync_with_stdio(0); //to synchronize the input of cin and scanf
#define INF 1001001001
#define PI 3.1415926535897932384626
//for map, pair
#define mp make_pair
#define fi first
#define se second
// for debug
inline void pisz(int n) { printf("%d\n",n); }
#define DBG(vari) cerr<<#vari<<" = "<<(vari)<<endl;
#define printA(a,L,R) FE(i,L,R) cout << a[i] << (i==R?'\n':' ')
#define printV(a) printA(a,0,a.size()-1)
#define MAXN 10000
//for vectors
#define pb push_back
typedef int elem_t;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> ii;
// directions
const int fx[4][2] = {{0,1}, {0,-1}, {1,0}, {-1,0}};
const int fxx[8][2] = {{0,1}, {0,-1}, {1,0}, {-1,0}, {1,1}, {1,-1}, {-1,1}, {-1,-1}};
template<typename T,typename TT> ostream& operator<<(ostream &s,pair<T,TT> t) {return s<<"("<<t.first<<","<<t.second<<")";}
template<typename T> ostream& operator<<(ostream &s,vector<T> t){F(i,0,SZ(t))s<<t[i]<<" ";return s; }

struct Reverse {
  bool operator()(int x, int y) {
    return y < x;
  }
};

int main()
{
	// TESTS
	{
		// cout << "hello";
		vector < ii > cmd,ncmd;
		wez(n);
		// DBG(n);
		string str;
		int t;
		F(i,0,n)
		{
			cin >> str;
			if( str[0] == 'i' )
			{
				cin >> t;
				cmd.pb( mp(1,t) );
			}
			else if( str[0] == 'g' )
			{
				cin >> t;
				cmd.pb( mp(2,t) );
			}
			else
			{
				cmd.pb( mp(0,0) );
			}
		}
		// printV(cmd);

		priority_queue <int, vector<int>, Reverse> pq;
		F(i,0,n)
		{
			// cout << "yes"<< endl;
			if(cmd[i].first == 1)
			{
				pq.push(cmd[i].second);
				ncmd.pb(cmd[i]);
			}
			else if(cmd[i].first == 0)
			{
				if(pq.empty())
					ncmd.pb( mp(1,1) );
				else
					pq.pop();
				ncmd.pb(cmd[i]);
			}
			else
			{
				// DBG(pq.top());
				// DBG(cmd[i].second);
				if(pq.empty())
				{
					ncmd.pb( mp(1,cmd[i].second) );
					pq.pb(cmd[i].second);
					ncmd.pb( cmd[i] );
				}
				else
				{
					if( cmd[i].second < pq.top() )
						ncmd.pb( mp(1,cmd[i].second) );
					else if( cmd[i].second > pq.top() )
					{
						while( !pq.empty() && cmd[i].second > pq.top() )
						{
							ncmd.pb( mp(0,0) );
							pq.pop();
						}
						if( pq.empty() || cmd[i].second < pq.top() )
							ncmd.pb( mp(1,cmd[i].second) );
					}
					ncmd.pb( cmd[i] );
				}

			}
			// printV(cmd);
			// printV(ncmd);
			// cout << endl;

		}

		cout << ncmd.size() << endl;
		F(i,0,ncmd.size())
		{
			if(ncmd[i].first == 0)
				cout << "removeMin\n";
			else if(ncmd[i].first == 1)
				cout << "insert " << ncmd[i].second << endl;
			else
				cout << "getMin " << ncmd[i].second << endl;
		}
	}
	return 0;
}