#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #define ll long long int #define pb push_back #define rep(i,n) for(int i=0;i<(n);i++) #define REP(i,n) for(int i=1;i<=(n);i++) using namespace std; int mx8[] = {0,0,1,-1,-1,1,-1,1}; int my8[] = {-1,1,0,0,-1,-1,1,1}; int mx4[] = {1,-1,0,0}; int my4[] = {0,0,-1,1}; const int MOD = 1000000007; ll y[10000005]; int main() { int n; cin >> n; vector flip(n,false); cout << 1 << " " << 1 << endl; flip[0] = true; while(true){ int t; cin >> t; if(t == 0) break; int k, x; cin >> k >> x; rep(i,k) flip[x-1+i] = true; rep(i,n){ if(!flip[i]) { cout << 1 << " " << i+1 << endl; flip[i] = true; } } } }