#include <bits/stdc++.h>
using namespace std;
template <class t>
inline void read(t &s) {
  s = 0;
  register long long f = 1;
  register char c = getchar();
  while (!isdigit(c)) {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (isdigit(c)) s = (s << 3) + (s << 1) + (c ^ 48), c = getchar();
  s *= f;
  return;
}
template <class t, class... A>
inline void read(t &x, A &...a) {
  read(x);
  read(a...);
}
template <class t>
inline void write(t x) {
  if (x < 0) putchar('-'), x = -x;
  long long buf[21], top = 0;
  while (x) buf[++top] = x % 10, x /= 10;
  if (!top) buf[++top] = 0;
  while (top) putchar(buf[top--] ^ '0');
  return;
}
inline void setIn(string s) {
  freopen(s.c_str(), "r", stdin);
  return;
}
inline void setOut(string s) {
  freopen(s.c_str(), "w", stdout);
  return;
}
inline void setIO(string s = "") {
  setIn(s + ".in");
  setOut(s + ".out");
  return;
}
template <class t>
inline bool checkmin(t &x, t y) {
  if (x > y) {
    x = y;
    return 1;
  }
  return 0;
}
template <class t>
inline bool checkmax(t &x, t y) {
  if (x < y) {
    x = y;
    return 1;
  }
  return 0;
}
inline long long lowbit(long long x) { return x & (-x); }
inline long long A(long long x, long long y) {
  printf("%lld %lld\n", x, y);
  fflush(stdout);
  register long long res;
  scanf("%lld", &res);
  if (!res) exit(0);
  return res;
}
inline void g(long long, long long, long long, long long, long long, long long);
inline void f(long long u, long long x, long long v, long long y) {
  register long long dx = (u + (x - u) / 5), dy = (v + (y - v) / 5);
  register long long opt = A(dx, dy);
  switch (opt) {
    case 1:
      f(dx + 1, x, v, y);
      break;
    case 2:
      f(u, x, dy + 1, y);
      break;
    case 3:
      g(u, x, v, y, dx - 1, dy - 1);
  }
  return;
}
inline void g(long long u, long long x, long long v, long long y, long long w,
              long long z) {
  if (u > w) {
    f(u, x, v, z);
    return;
  }
  if (v > z) {
    f(u, w, v, y);
    return;
  }
  register long long dx = (u + 4 * (w - u) / 5), dy = (v + 4 * (z - v) / 5);
  register long long opt = A(dx, dy);
  switch (opt) {
    case 1:
      g(dx + 1, x, v, y, w, z);
      break;
    case 2:
      g(u, x, dy + 1, y, w, z);
      break;
    case 3:
      g(u, x, v, y, dx - 1, dy - 1);
      break;
  }
  return;
}
signed main(void) {
  long long n;
  read(n);
  f(1, n, 1, n);
  return 0;
}
