#include <bits/stdc++.h>
using namespace std;
const int N = 3e5 + 10;
const int SQRTN = 320;
const int LOGN = 20;
const long double PI = acos(-1);
int n;
vector<pair<int, int> > v;
char s[111];
int a;
priority_queue<int> q;
map<int, string> ss;
int main() {
  cin >> n;
  ss[1] = "insert ";
  ss[2] = "getMin ";
  ss[3] = "removeMin\n";
  for (int i = 0; i < n; i++) {
    scanf(" %s %d", s, &a);
    if (s[0] == 'i') {
      v.push_back(make_pair(1, a));
      q.push(-a);
    }
    if (s[0] == 'r') {
      if (q.empty()) {
        q.push(1000000000);
        v.push_back(make_pair(1, 1));
      }
      q.pop();
      v.push_back(make_pair(3, 0));
    }
    if (s[0] == 'g') {
      while (!q.empty()) {
        if (-q.top() < a) {
          v.push_back(make_pair(3, 0));
          q.pop();
        }
        if (-q.top() > a) {
          q.push(-a);
          v.push_back(make_pair(1, a));
          break;
        }
        if (q.top() == -a) break;
      }
      if (q.empty()) q.push(-a), v.push_back(make_pair(1, a));
      v.push_back(make_pair(2, a));
    }
  }
  cout << v.size() << endl;
  for (int i = 0; i < v.size(); i++) {
    printf("%s", ss[v[i].first].c_str());
    if (v[i].first != 3) printf("%d\n", v[i].second);
  }
  return 0;
}
