#include <bits/stdc++.h>
using namespace std;
using int64 = long long int;
int guess(const int64 x, const int64 y) {
  cout << x << " " << y << "\n";
  cout.flush();
  int ans;
  cin >> ans;
  return ans;
}
void solve(const int64 x0, const int64 y0, const int64 x1, const int64 y1,
           const int64 x2, const int64 y2) {
  if (x0 + 1 == x2 && y0 + 1 == y2) {
    guess(x0, y0);
    return;
  }
  if (x1 >= x2 || y1 >= y2) {
    const int64 x = (2 * x0 + x2) / 3;
    const int64 y = (2 * y0 + y2) / 3;
    const int g = guess(x, y);
    switch (g) {
      case 1:
        solve(x + 1, y0, x2, y2, x2, y2);
        break;
      case 2:
        solve(x0, y + 1, x2, y2, x2, y2);
        break;
      case 3:
        solve(x0, y0, x, y, x2, y2);
        break;
    }
    return;
  }
  if (x1 - x0 > y1 - y0) {
    const int64 x = (x0 + x1) / 2;
    const int64 y = y1;
    const int g = guess(x, y);
    switch (g) {
      case 1:
        solve(x + 1, y0, x1, y1, x2, y2);
        break;
      case 2:
        solve(x0, y + 1, x1, y2, x1, y2);
        break;
      case 3:
        solve(x0, y0, x, y, x2, y2);
        break;
    }
    return;
  }
  const int64 x = x1;
  const int64 y = (y0 + y1) / 2;
  const int g = guess(x, y);
  switch (g) {
    case 1:
      solve(x + 1, y0, x2, y1, x2, y1);
      break;
    case 2:
      solve(x0, y + 1, x1, y1, x2, y2);
      break;
    case 3:
      solve(x0, y0, x, y, x2, y2);
      break;
  }
}
void solve() {
  int64 n;
  cin >> n;
  solve(1, 1, n + 1, n + 1, n + 1, n + 1);
}
int main() {
  solve();
  return 0;
}
