#include using namespace std; int n; int main() { cin >> n; cout << 2 - (n & 1) << " " << (n + 1) / 2 << endl; while (1) { int t = 0; cin >> t; if (!t) break; int k, x; cin >> k >> x; cout << k << " " << (n + 1 - x - ((k ^ 1) & 1)) << endl; } return 0; }