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