#include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1);
const int INF = 1000 * 1000 * 1000 + 7;
const long long LINF = INF * (long long)INF;
priority_queue<int> q;
char ch[100];
vector<pair<string, int> > R;
void insert(int a) {
  q.push(-a);
  R.push_back(make_pair("insert", a));
}
void removeMin() {
  if (q.empty()) insert(1);
  q.pop();
  R.push_back(make_pair("removeMin", -INF));
}
void getMin(int a) {
  while (!q.empty() && -q.top() < a) removeMin();
  if (q.empty() || -q.top() != a) {
    insert(a);
  }
  R.push_back(make_pair("getMin", a));
  return;
}
int main() {
  int n;
  scanf("%d", &n);
  for (int i = (0); i < (n); i++) {
    int a;
    scanf("%s", ch);
    if (ch[0] == 'i' || ch[0] == 'g') scanf("%d", &a);
    if (ch[0] == 'i') {
      insert(a);
      continue;
    }
    if (ch[0] == 'g') {
      getMin(a);
      continue;
    }
    removeMin();
  }
  printf("%d\n", (int)R.size());
  for (int i = (0); i < ((int)R.size()); i++) {
    printf("%s", R[i].first.c_str());
    if (R[i].second != -INF) {
      printf(" %d", R[i].second);
    }
    printf("\n");
  }
  return 0;
}
