#include <bits/stdc++.h>
using std::max;
using std::min;
long long read() {
  long long x = 0;
  char c = getchar();
  bool f = 0;
  while (c < '0' || c > '9') (c == '-') ? f = 1, c = getchar() : c = getchar();
  while (c >= '0' && c <= '9')
    x = (x << 1) + (x << 3) + (48 ^ c), c = getchar();
  return (f) ? -x : x;
}
void write(const long long &x) {
  if (x / 10) write(x / 10);
  putchar('0' + x % 10);
}
inline int Ask(const long long &x, const long long &y) {
  write(x), putchar(' '), write(y), putchar('\n');
  fflush(stdout);
  return read();
}
int main() {
  long long n = read();
  long long x = 0, y = 0, dx = 1, dy = 1;
  while (1) {
    int ask = Ask(x + dx, y + dy);
    if (ask == 1)
      x += dx, dx = min(n - x, 2 * dx);
    else if (ask == 2)
      y += dy, dy = min(n - y, 2 * dy);
    else if (ask == 3)
      dx = max(1ll, dx / 2), dy = max(1ll, dy / 2);
    else
      break;
  }
}
