#include #define rep(a,n) for (ll a = 0; a < (n); ++a) using namespace std; using ll = long long; typedef pair P; typedef pair PP; typedef vector > Graph; template inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; } template inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; } const ll INF = 1e18; //入力 ll n; ll t; bool done[110]; void solve(){ int s = 0; int now = 0; rep(i,n){ if(done[i]){ s ^= (now-1)%3; now=0; } else{ now++; } } s ^= (now-1)%3; if(s<=1){ rep(i,n){ if(!done[i]){ cout << 1 << ' ' << i+1 << flush; done[i]=true; break; } } } if(s==2){ rep(i,n-1){ if(!done[i] and !done[i+1]){ cout << 2 << ' ' << i+1 << flush; done[i]=true; done[i+1]=true; break; } } rep(i,n){ if(!done[i]){ cout << 1 << ' ' << i+1 << flush; done[i]=true; break; } } } return; } int main(){ cin >> n; rep(i,n)done[i]=false; solve(); while(cin>>t and t>=2){ int k,x; cin >> k >> x; rep(i,k)done[x+i]=true; solve(); } return 0; }