#include #include #include #include #include #include #include #include #include #include #define mkp make_pair #define mkt make_tuple #define rep(i,n) for(int i = 0; i < (n); ++i) #define all(v) v.begin(),v.end() using namespace std; typedef long long ll; const ll MOD=1e9+7; template void chmin(T &a,const T &b){if(a>b) a=b;} template void chmax(T &a,const T &b){if(a>N; if(N%2) output(1,(N+1)/2); else output(2,N/2); while(1){ int t;cin>>t; if(t<=1) exit(0); int k,x; cin>>k>>x; if(t==2) exit(0); int half=N/2; if(x<(N+1)/2) output(k,x+half+1); else output(k,x-(half+1)); } return 0; }