#include <bits/stdc++.h>
const int mod = 1000000007;
const int N = 100005;
using namespace std;
int arr[N], brr[N];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  priority_queue<int, vector<int>, greater<int> > pq;
  vector<pair<string, int> > vc;
  string s;
  int q, x;
  cin >> q;
  while (q--) {
    cin >> s;
    if (s[0] == 'i') {
      cin >> x;
      pq.push(x);
      vc.push_back({"insert", x});
    } else if (s[0] == 'g') {
      cin >> x;
      while (!pq.empty() && pq.top() < x) {
        pq.pop();
        vc.push_back({"removeMin", 0});
      }
      if (pq.empty() || pq.top() != x) {
        pq.push(x);
        vc.push_back({"insert", x});
      }
      vc.push_back({"getMin", x});
    } else {
      if (!pq.empty()) {
        pq.pop();
        vc.push_back({"removeMin", 0});
      } else {
        vc.push_back({"insert", 0});
        vc.push_back({"removeMin", 0});
      }
    }
  }
  cout << vc.size() << "\n";
  for (int i = 0; i < vc.size(); i++) {
    cout << vc[i].first;
    if (vc[i].first != "removeMin") cout << " " << vc[i].second;
    cout << endl;
  }
  return 0;
}
