#include <bits/stdc++.h>
using namespace std;
multiset<int> s;
vector<pair<string, int> > res;
int main() {
  int N, x, y;
  cin >> N;
  for (int n = 0; n < N; ++n) {
    char query[30];
    scanf("%s", query);
    if (query[0] == 'i') {
      scanf("%d", &x);
      res.push_back(make_pair("insert", x));
      s.insert(x);
    } else if (query[0] == 'g') {
      scanf("%d", &x);
      bool f = false;
      if (s.size() > 0) {
        while (s.size() > 0) {
          y = *s.begin();
          if (y < x) {
            res.push_back(make_pair("removeMin", -1));
            s.erase(s.begin());
          } else if (y == x) {
            f = true;
            res.push_back(make_pair("getMin", y));
            break;
          } else {
            f = true;
            res.push_back(make_pair("insert", x));
            s.insert(x);
            res.push_back(make_pair("getMin", x));
            break;
          }
        }
      }
      if (s.size() == 0) {
        f = true;
        res.push_back(make_pair("insert", x));
        s.insert(x);
        res.push_back(make_pair("getMin", x));
      }
      assert(f);
    } else {
      if (s.size() == 0) {
        res.push_back(make_pair("insert", 1000000000));
        res.push_back(make_pair("removeMin", -1));
      } else {
        s.erase(s.begin());
        res.push_back(make_pair("removeMin", -1));
      }
    }
  }
  cout << res.size() << endl;
  for (int n = 0; n < res.size(); ++n) {
    if (res[n].first == "insert") {
      printf("%s %d\n", res[n].first.c_str(), res[n].second);
    } else if (res[n].first == "getMin") {
      printf("%s %d\n", res[n].first.c_str(), res[n].second);
    } else {
      printf("%s\n", res[n].first.c_str());
    }
  }
  return 0;
}
