#include <bits/stdc++.h>
using namespace std;
const int N = 3e3 + 5, SEG = (1 << 18);
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n;
  cin >> n;
  vector<pair<string, int>> res;
  string a1 = "insert", a2 = "getMin", a3 = "removeMin";
  string a;
  int b;
  priority_queue<int, vector<int>, greater<int>> pq;
  while (n--) {
    cin >> a;
    if (a == a1) {
      cin >> b;
      pq.push(b);
      res.push_back({a, b});
    } else if (a == a2) {
      cin >> b;
      while (pq.size() && pq.top() < b) {
        pq.pop();
        res.push_back({a3, -1});
      }
      if ((pq.size() && pq.top() != b) || pq.empty()) {
        res.push_back({a1, b});
        pq.push(b);
      }
      res.push_back({a2, b});
    } else {
      if (pq.empty()) {
        res.push_back({a1, -1000000000});
        pq.push(-1000000000);
      }
      pq.pop();
      res.push_back({a3, -1});
    }
  }
  cout << res.size() << '\n';
  for (auto r : res) {
    if (r.first == a3) {
      cout << a3 << '\n';
    } else
      cout << r.first << " " << r.second << '\n';
  }
  return 0;
}
