#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <vector>

using namespace std;

#define pb push_back
#define x first
#define y second
#define mp make_pair

const int MAX_N = 200 + 1;

int AIB[MAX_N][MAX_N];
bool bad[MAX_N][MAX_N];

int n = 200;

int lsb(const int x) {
  return x & (-x);
}

void update(int x, int y, int val) {
  for(int i = x; i <= n; i += lsb(i))
    for(int j = y; j <= n; j += lsb(j))
      AIB[i][j] += val;
}

int query(int x, int y) {
  int sum = 0;
  for(int i = x; i > 0; i -= lsb(i))
    for(int j = y; j > 0; j -= lsb(j))
      sum += AIB[i][j];

  return sum;
}

int score(int x, int y) {
  int s1 = query(x, y);
  int s2 = query(n, n) - query(n, y - 1) - query(x - 1, n) + query(x - 1, y - 1);
  return min(s1, s2);
}

int ask(int x, int y) {
  printf("%d %d\n", x, y);
  fflush(stdout);
  int ret;
  scanf("%d", &ret);
  if(ret == 0) {
    exit(0);
  }
  return ret;
}

void rm(int x, int y){
  int val = ask(x, y);

  if(val < 0) {
    for(int i = x; i >= 1; --i) {
      if(bad[i][y])
        break;
      for(int j = y; j >= 1; --j) {
        if(bad[i][j])
          break;
        bad[i][j] = 1;
        update(i, j, -1);
      }
    }
  } else {
    for(int i = x; i <= n; ++i) {
      if(bad[i][y])
        break;
      for(int j = y; j <= n; ++j) {
        if(bad[i][j])
          break;
        bad[i][j] = 1;
        update(i, j, -1);
      }
    }
  }
}

vector<pair<int, int>> cells;

void solve() {

  for(int i = 1; i <= n; ++i)
    for(int j = 1; j <= n; ++j)
      update(i, j, 1);

  while(true) {
    int cx = -1, cy = -1;
    int best = -1;
    for(int i = 1; i <= n; ++i) {
      for(int j = 1; j <= n; ++j) {
        if(bad[i][j])
          continue;

        int now = score(i, j);

        if(best == -1 || now > best) {
          best = now;
          cx = i;
          cy = j;
        }
      }
    }

    rm(cx, cy);
  }
}

int main() {
  solve();
  return 0;
}