#include<iostream> using namespace std; int N; main() { cin>>N; int R; if(N%2==1) { cout<<"1 "<<N/2+1<<endl; R=N/2+1; } else { cout<<"2 "<<N/2<<endl; R=N/2+1; } while(true) { int t;cin>>t; if(t==0||t==1)break; int k,x;cin>>k>>x; if(t==2)break; if(x<R) { cout<<k<<" "<<x+R<<endl; } else { cout<<k<<" "<<x-R<<endl; } } }