#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
string pp[1000006];
int xx[1000006];
int ct = 0;
inline void ins(int x) {
  pp[ct] = ("insert ");
  xx[ct++] = x;
}
inline void rem() {
  pp[ct] = ("removeMin");
  xx[ct++] = 0;
}
inline void get(int k) {
  pp[ct] = ("getMin ");
  xx[ct++] = k;
}
int main() {
  ios_base::sync_with_stdio(false);
  int n, t, m, l, k, ans, i, j, res = 0, fl;
  t = 1;
  while (t--) {
    priority_queue<int> ss;
    cin >> n;
    string s;
    for (i = 0; i < n; i++) {
      cin >> s;
      if (s[0] != 'r') cin >> k;
      if (s[0] == 'i') {
        ss.push(-k);
        ins(k);
      }
      if (s[0] == 'r') {
        if (ss.empty()) {
          ins(1);
          rem();
        } else {
          ss.pop();
          rem();
        }
      }
      if (s[0] == 'g') {
        while (!ss.empty() and (ss.top()) > -k) {
          ss.pop();
          rem();
        }
        if (!ss.empty() and ss.top() == -k)
          get(k);
        else {
          ss.push(-k);
          ins(k);
          get(k);
        }
      }
    }
    cout << ct << '\n';
    for (i = 0; i < ct; i++) {
      cout << pp[i];
      if (pp[i][0] != 'r') cout << xx[i];
      cout << '\n';
    }
  }
  return 0;
}
