#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
vector <int> q[11];
int ask(int l, int r) {
cout << l << ' ' << r << '\n';
cout << flush;
int ret;
cin >> ret;
return ret;
}
int cnt, cur, n;
bool dfs(int dep) {
if (dep == q[cnt].size()) return false;
if (dfs(dep + 1)) {
if (cur == n) return true;
return true;
}
int temp = ask(cnt, q[cnt][dep]);
if (temp == n) {
cur = n;
return true;
}
if (temp < cur) {
flg = true;
temp = ask(cnt, q[cnt][dep]);
cur = temp;
}
if (temp > cur) {
cur = temp;
flg = true;
}
if (dfs(dep + 1)) {
if (cur == n) return true;
return true;
}
return flg;
}
int main() {
cin >> n;
for (int i = 1; i <= n; i ++) {
for (int j = n; j >= i; j --) {
q[i].push_back(j);
}
}
cin >> cur;
cnt = 1;
while (cur != n && cnt != n + 1) {
dfs(0);
cnt ++;
}
assert(cur == n);
return 0;
}