#include using namespace std; #define int long long typedef pair P; int INF = 1e9+7; int mod = 1e9+7; int dx[4] = {1, 0, -1, 0}; int dy[4] = {0, 1, 0, -1}; signed main(){ int N; cin >> N; vectorok(N,true); if(N == 1 || N == 2) { cout << N << " " << 1 << endl; int t;cin >> t; return 0; } cout << (N+1)%2+1 << " " << (N-1)/2+1 << endl; for(int i = (N-1)/2; i < (N+1)/2+(N+1)%2; i++) { ok[i] = false; } int cnt = (N-1)/2*2; while(true) { int t;cin >> t; if(t == 0) { return 0; } int k,x;cin >> k >> x; for(int i = 0; i < x; i++) { ok[k-1+i] = false; } cnt -= x; if(cnt <= 2) { for(int i = 0; i < N; i++) { if(ok[i]) { cout << cnt << " " << i+1 << endl; break; } } int t;cin >> t; return 0; } int res = 0; for(int i = 0; i < N; i++) { if(ok[i]) { res++; } else { if(res >= 3) { cout << (res+1)%2+1 << " " << (i+i-res)/2+1 << endl; cnt -= (res+1)%2+1; for(int j = (i+i-res)/2; j < (i+i-res)/2+(res+1)%2+1; j++) { ok[j] = false; } goto prime; } res = 0; } } if(res >= 3) { cout << (res+1)%2+1 << " " << (N+N-res)/2+1 << endl; cnt -= (res+1)%2+1; for(int j = (N+N-res)/2; j < (N+N-res)/2+(res+1)%2+1; j++) { ok[j] = false; } goto prime; } res = 0; for(int i = 0; i < N; i++) { if(ok[i]) { ok[i] = false; cout << 1 << " " << i+1 << endl; break; } } prime:; } }