#include <bits/stdc++.h>
using namespace std;
int n, x;
char s[13];
vector<int> sol[2];
priority_queue<int> S;
char word[3][12] = {"insert", "getMin", "removeMin"};
map<char, int> mapa = {{'i', 0}, {'g', 1}, {'r', 2}};
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%s", &s);
    if (s[0] == 'r') {
      if (S.empty()) {
        sol[0].push_back(0);
        sol[1].push_back(1);
      } else {
        S.pop();
      }
    } else {
      scanf("%d", &x);
      x = -x;
      if (s[0] == 'i') {
        S.push(x);
      }
      if (s[0] == 'g') {
        while (!S.empty() && S.top() > x) {
          S.pop();
          sol[0].push_back(2);
          sol[1].push_back(0);
        }
        if (S.empty() || S.top() != x) {
          S.push(x);
          sol[0].push_back(0);
          sol[1].push_back(x);
        }
      }
    }
    sol[0].push_back(mapa[s[0]]);
    sol[1].push_back(x);
  }
  printf("%d\n", sol[0].size());
  for (int i = 0; i < sol[0].size(); i++) {
    if (sol[0][i] == 2) {
      printf("%s\n", word[sol[0][i]]);
    } else {
      printf("%s %d\n", word[sol[0][i]], -sol[1][i]);
    }
  }
  return 0;
}
