#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e7 + 7;
const int inf = 1e9 + 9;
const long long MOD = 1e9 + 696969;
inline bool MN(pair<int, int> jed, pair<int, int> dwa) {
  return (jed.second < dwa.second ||
          (jed.second == dwa.second && jed.first < dwa.first));
}
inline bool WI(pair<int, int> jed, pair<int, int> dwa) {
  return (jed.second > dwa.second ||
          (jed.second == dwa.second && jed.first > dwa.first));
}
inline long long det(pair<int, int> &a, pair<int, int> &b) {
  return (long long)a.first * b.second - (long long)a.second * b.first;
}
inline long long area2(pair<int, int> &a, pair<int, int> &b,
                       pair<int, int> &c) {
  return det(a, b) + det(b, c) + det(c, a);
}
inline long long aarea2(pair<int, int> &a, pair<int, int> &b,
                        pair<int, int> &c) {
  return abs(area2(a, b, c));
}
inline bool na_lewo(pair<int, int> &a, pair<int, int> &b, pair<int, int> &c) {
  return area2(a, b, c) > 0;
}
inline bool na_prawo(pair<int, int> &a, pair<int, int> &b, pair<int, int> &c) {
  return area2(a, b, c) < 0;
}
inline long long dist2(pair<int, int> &a, pair<int, int> &b) {
  return (long long)(a.first - b.first) * (long long)(a.first - b.first) +
         (long long)(a.second - b.second) * (long long)(a.second - b.second);
}
inline bool cmp(pair<int, int> &start, pair<int, int> &a, pair<int, int> &b) {
  if (WI(a, start) && MN(b, start)) return 1;
  if (WI(b, start) && MN(a, start)) return 0;
  long long D = area2(start, a, b);
  if (D == 0) return dist2(start, a) < dist2(start, b);
  return D > 0;
}
inline bool nieostry(pair<int, int> &a, pair<int, int> &b, pair<int, int> &c) {
  return dist2(a, c) >= dist2(b, c) + dist2(a, b);
}
inline bool ostry(pair<int, int> &a, pair<int, int> &b, pair<int, int> &c) {
  return dist2(a, c) < dist2(b, c) + dist2(a, b);
}
int n, m, k, DL = 0, CC = 0, T;
multiset<int> q;
vector<pair<string, int> > v;
void ans(int type, int number) {
  if (type == 0) v.push_back(make_pair("removeMin\n", -1));
  if (type == 1) v.push_back(make_pair("insert", number));
  if (type == 2) v.push_back(make_pair("getMin", number));
}
int main() {
  v.clear();
  ios_base::sync_with_stdio(false);
  cin >> T;
  while (T--) {
    string s;
    cin >> s;
    int a;
    if (s[0] != 'r') cin >> a;
    if (s[0] == 'r') {
      if (!q.empty())
        q.erase(q.begin());
      else
        ans(1, 1);
      ans(0, 0);
    }
    if (s[0] == 'i') {
      ans(1, a);
      q.insert(a);
    }
    if (s[0] == 'g') {
      while (!q.empty() && *q.begin() < a) q.erase(q.begin()), ans(0, 0);
      if (q.empty() || *q.begin() != a) q.insert(a), ans(1, a);
      ans(2, a);
    }
  }
  cout << v.size() << endl;
  for (int i = (0); i <= (v.size() - 1); ++i) {
    if (v[i].first[0] == 'r')
      cout << v[i].first;
    else
      cout << v[i].first << ' ' << v[i].second << "\n";
  }
}
