#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-7;
long long n;
inline void orz(long long a, long long b, long long c, long long d, long long e,
                long long f);
inline void orz(long long a, long long b, long long c, long long d) {
  long long x, y;
  int p;
  x = a + (long long)(0.2 * (b - a) + eps);
  y = c + (long long)(0.2 * (d - c) + eps);
  cout << x << " " << y << "\n";
  fflush(stdout);
  cin >> p;
  if (!p) exit(0);
  if (p == 1) orz(x + 1, b, c, d);
  if (p == 2) orz(a, b, y + 1, d);
  if (p == 3) orz(a, b, c, d, x - 1, y - 1);
}
inline void orz(long long a, long long b, long long c, long long d, long long e,
                long long f) {
  if (a > e) orz(a, b, c, f);
  if (c > f) orz(a, e, c, d);
  long long x, y;
  int p;
  x = a + (long long)(0.8 * (e - a) + eps);
  y = c + (long long)(0.8 * (f - c) + eps);
  cout << x << " " << y << "\n";
  fflush(stdout);
  cin >> p;
  if (!p) exit(0);
  if (p == 1) orz(x + 1, b, c, d, e, f);
  if (p == 2) orz(a, b, y + 1, d, e, f);
  if (p == 3) orz(a, b, c, d, x - 1, y - 1);
}
int main() {
  cin >> n;
  orz(1, n, 1, n);
  return 0;
}
