#include <bits/stdc++.h>
using namespace std;

int main() {
    int n;
    cin >> n;
    if (n % 2 == 0) {
        cout << "2 " << n / 2 << endl;
    } else {
        cout << "1 " << (n + 1) / 2 << endl;
    }
    
    for (;;) {
        int t;
        cin >> t;
        if (t == 0) return 0;
        if (t == 1) return 1;
        if (t == 2) return 0;
        
        int k, x;
        cin >> k >> x;
        cout << k << " " << n - x - k + 2 << endl;
    }
}