#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mk make_pair
#define pi pair<int,int>
#define pii pair< pi >
string to_str(int n) {
stringstream ss;
ss << n;
string str = ss.str();
return str;
}
multiset<int> s;
vector<string> ans;
string op, temp;
int no,n;
string g[3] = {"insert ", "removeMin ", "getMin "};
int main() {
ans.clear();
s.clear();
ios_base::sync_with_stdio(false);
cin >> n;
for(int i=0;i<n;i++) {
cin >> op;
if(op[0]!='r')
cin >> no;
if(op[0]=='i') {
s.insert(no);
ans.pb(g[0] + to_str(no));
}
else if(op[0]=='r') {
if(s.empty()) {
ans.pb(g[0]+ "1");
s.insert(1);
//temp = g[1];
//ans.pb(temp);
}
s.erase(s.begin());
ans.pb(g[1]);
}
else {
while(!s.empty() && *(s.begin())<no) {
s.erase(s.begin());
ans.pb(g[1]);
}
if(s.empty() || *(s.begin())!=no) {
s.insert(no);
ans.pb(g[0] + to_str(no));
//temp = g[2] + to_str(no);
//ans.pb(temp);
}
ans.pb(g[2] + to_str(no));
}
}
cout << ans.size() << endl;
for(int i=0;i<ans.size();i++) {
cout << ans[i] << endl;
}
return 0;
}
I2luY2x1ZGU8Yml0cy9zdGRjKysuaD4KdXNpbmcgbmFtZXNwYWNlIHN0ZDsKI2RlZmluZSBsbCBsb25nIGxvbmcKI2RlZmluZSBwYiBwdXNoX2JhY2sKI2RlZmluZSBtayBtYWtlX3BhaXIKI2RlZmluZSBwaSBwYWlyPGludCxpbnQ+CiNkZWZpbmUgcGlpIHBhaXI8IHBpID4Kc3RyaW5nIHRvX3N0cihpbnQgbikgewogICAgICAgIHN0cmluZ3N0cmVhbSBzczsKICAgICAgICBzcyA8PCBuOwogICAgICAgIHN0cmluZyBzdHIgPSBzcy5zdHIoKTsKICAgICAgICByZXR1cm4gc3RyOwp9CgptdWx0aXNldDxpbnQ+IHM7CnZlY3RvcjxzdHJpbmc+IGFuczsKc3RyaW5nIG9wLCB0ZW1wOwppbnQgbm8sbjsKc3RyaW5nIGdbM10gPSB7Imluc2VydCAiLCAicmVtb3ZlTWluICIsICJnZXRNaW4gIn07CmludCBtYWluKCkgewogICAgICAgIGFucy5jbGVhcigpOwogICAgICAgIHMuY2xlYXIoKTsKICAgICAgICBpb3NfYmFzZTo6c3luY193aXRoX3N0ZGlvKGZhbHNlKTsKICAgICAgICBjaW4gPj4gbjsKICAgICAgICBmb3IoaW50IGk9MDtpPG47aSsrKSB7CiAgICAgICAgICAgICAgICBjaW4gPj4gb3A7CiAgICAgICAgICAgICAgICBpZihvcFswXSE9J3InKQogICAgICAgICAgICAgICAgICAgICAgICBjaW4gPj4gbm87CiAgICAgICAgICAgICAgICBpZihvcFswXT09J2knKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHMuaW5zZXJ0KG5vKTsKICAgICAgICAgICAgICAgICAgICAgICAgYW5zLnBiKGdbMF0gKyB0b19zdHIobm8pKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGVsc2UgaWYob3BbMF09PSdyJykgewogICAgICAgICAgICAgICAgICAgICAgICBpZihzLmVtcHR5KCkpIHsKCQkJCQkJCQkgICBhbnMucGIoZ1swXSsgIjEiKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzLmluc2VydCgxKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvL3RlbXAgPSBnWzFdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vYW5zLnBiKHRlbXApOwogICAgICAgICAgICAgICAgICAgICAgICB9CgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHMuZXJhc2Uocy5iZWdpbigpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhbnMucGIoZ1sxXSk7CgogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZWxzZSB7CgoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHdoaWxlKCFzLmVtcHR5KCkgJiYgKihzLmJlZ2luKCkpPG5vKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHMuZXJhc2Uocy5iZWdpbigpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYW5zLnBiKGdbMV0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYocy5lbXB0eSgpIHx8ICoocy5iZWdpbigpKSE9bm8pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcy5pbnNlcnQobm8pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhbnMucGIoZ1swXSArIHRvX3N0cihubykpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvL3RlbXAgPSBnWzJdICsgdG9fc3RyKG5vKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy9hbnMucGIodGVtcCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFucy5wYihnWzJdICsgdG9fc3RyKG5vKSk7CgogICAgICAgICAgICAgICAgICAgICAgICB9CgoKICAgICAgICB9CiAgICAgICAgY291dCA8PCBhbnMuc2l6ZSgpIDw8IGVuZGw7CiAgICAgICAgZm9yKGludCBpPTA7aTxhbnMuc2l6ZSgpO2krKykgewogICAgICAgICAgICAgICAgY291dCA8PCBhbnNbaV0gPDwgZW5kbDsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIDA7Cgp9