#include <bits/stdc++.h>
using namespace std;
int ans;
char a1[] = "insert";
char a2[] = "removeMin";
char a3[] = "getMin";
int a[1000005];
int b[1000005];
multiset<int> se;
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    char s[15];
    scanf("%s", s);
    int x = 0;
    if (s[0] != 'r') scanf("%d", &x);
    if (s[0] == 'i') {
      se.insert(x);
      a[ans] = 1;
      b[ans] = x;
      ans++;
    } else if (s[0] == 'r') {
      if (se.empty()) {
        a[ans] = 1;
        b[ans] = x;
        ans++;
        se.insert(x);
      }
      se.erase(se.begin());
      a[ans] = 2;
      b[ans] = 0;
      ans++;
    } else {
      while (!se.empty() && *se.begin() < x) {
        a[ans] = 2;
        b[ans] = 0;
        ans++;
        se.erase(se.begin());
      }
      if (se.empty() || *se.begin() != x) {
        se.insert(x);
        a[ans] = 1;
        b[ans] = x;
        ans++;
      }
      a[ans] = 3;
      b[ans] = x;
      ans++;
    }
  }
  cout << ans << endl;
  for (int i = 0; i < ans; i++) {
    if (a[i] == 1) {
      printf("%s %d\n", a1, b[i]);
    } else if (a[i] == 3) {
      printf("%s %d\n", a3, b[i]);
    } else
      printf("%s\n", a2);
  }
}
