#include <bits/stdc++.h>
using namespace std;
map<string, int> mp;
int jg(int a, int b, int c, int d) {
  int ans = 0;
  ans = abs(c - a) + abs(d - b);
  return ans;
}
int main() {
  int n, m;
  cin >> n >> m;
  int a[50];
  int b[50];
  int c[50];
  int d[50];
  for (int i = 0; i < n; i++) {
    cin >> a[i] >> b[i];
  }
  for (int i = 0; i < m; i++) {
    cin >> c[i] >> d[i];
  }
  for (int i = 0; i < (n); i++) {
    int ans;
    int k = 0;
    for (int k = 0; k < (m); k++) {
      if (ans > jg(a[i], b[i], c[k], d[k])) ans = jg(a[i], b[i], c[k], d[k]);
    }
    cout << k << " " << ans << endl;
  }
}
