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