#include <bits/stdc++.h>
int heap[1000000];
char storage[550000][24];
int size_heap;
void insert_heap(int a) {
  heap[++size_heap] = a;
  int chk = size_heap;
  while (heap[chk] < heap[chk / 2]) {
    int temp = heap[chk];
    heap[chk] = heap[chk / 2];
    heap[chk / 2] = temp;
    chk /= 2;
  }
}
void delete_min() {
  heap[1] = heap[size_heap];
  heap[size_heap--] = 0;
  int i;
  for (i = 1; i * 2 <= size_heap;) {
    if (((i * 2) + 1) <= size_heap && heap[i * 2 + 1] <= heap[i * 2] &&
        heap[i * 2 + 1] < heap[i]) {
      int temp = heap[i];
      heap[i] = heap[i * 2 + 1];
      heap[i * 2 + 1] = temp;
      i = i * 2 + 1;
    } else if (heap[i * 2] < heap[i]) {
      int temp = heap[i];
      heap[i] = heap[i * 2];
      heap[i * 2] = temp;
      i = i * 2;
    } else
      break;
  }
}
int main() {
  int a, b, c, d, e, f;
  scanf("%d", &a);
  getchar();
  int i;
  int k = 0;
  heap[0] = INT_MIN;
  for (i = 0; i < a; i++) {
    char in[250];
    int in1;
    scanf("%s%d", in, &in1);
    if (in[0] == 'i') {
      insert_heap(in1);
      sprintf(storage[k++], "insert %d", in1);
    } else if (in[0] == 'g') {
      if (in[1] == in1 && size_heap != 0) {
        sprintf(storage[k++], "getMin %d", in1);
      } else {
        while (heap[1] != in1 && size_heap != 0 && heap[1] < in1) {
          delete_min();
          sprintf(storage[k++], "removeMin");
        }
        if (heap[1] == in1 && size_heap != 0) {
          sprintf(storage[k++], "getMin %d", in1);
        } else if (size_heap == 0) {
          sprintf(storage[k++], "insert %d", in1);
          insert_heap(in1);
          sprintf(storage[k++], "getMin %d", in1);
        } else {
          sprintf(storage[k++], "insert %d", in1);
          insert_heap(in1);
          sprintf(storage[k++], "getMin %d", in1);
        }
      }
    } else if (in[0] == 'r') {
      if (size_heap == 0) {
        sprintf(storage[k++], "insert 0");
        sprintf(storage[k++], "removeMin");
      } else {
        delete_min();
        sprintf(storage[k++], "removeMin");
      }
    }
  }
  printf("%d\n", k);
  for (i = 0; i < k; i++) {
    puts(storage[i]);
  }
}
