#include <bits/stdc++.h>
int main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  int N, M;
  std::cin >> N >> M;
  int *a, *b, *c, *d;
  a = new int[N];
  b = new int[N];
  c = new int[M];
  d = new int[M];
  for (int i = 0; i < N; i++) {
    std::cin >> a[i] >> b[i];
  }
  for (int j = 0; j < M; j++) {
    std::cin >> c[j] >> d[j];
  }
  for (int i = 0; i < N; i++) {
    int index = -1;
    int maxd = -1;
    for (int j = 0; j < M; j++) {
      int distance = abs(c[j] - a[i]) + abs(d[j] - b[i]);
      if (distance > maxd) {
        index = j;
        maxd = distance;
      }
    }
    std::cout << c[index] << " " << d[index] << "\n";
  }
}
