#include <bits/stdc++.h>
using namespace std;
int query(long long a, long long b) {
  cout << a << " " << b << endl << flush;
  int ans;
  cin >> ans;
  return ans;
}
int main() {
  long long n;
  cin >> n;
  long long a = 0, b = 0, sa = 1, sb = 1;
  int ans = query(a + sa, b + sb);
  while (ans) {
    switch (ans) {
      case 1:
        a += sa;
        sa = min(sa * 2, n - a);
        break;
      case 2:
        b += sb;
        sb = min(sb * 2, n - b);
        break;
      case 3:
        sa = max(sa / 2, 1ll);
        sb = max(sb / 2, 1ll);
        break;
      default:
        return 0;
    }
    ans = query(a + sa, b + sb);
  }
  return 0;
}
