#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9;
const int MAX_N = 2 * 1e5 + 1;
vector<long long> st(4 * MAX_N);
vector<pair<pair<int, int>, pair<int, int>>> a;
vector<pair<int, int>> b;
void build(int p, int l, int r) {
  if (l == r) {
    st[p] = (1LL * a[l].first.first + 1LL * a[l].first.second);
    return;
  }
  int mid = (l + r) >> 1;
  build(2 * p + 1, l, mid);
  build(2 * p + 2, mid + 1, r);
  st[p] = max(st[2 * p + 1], st[2 * p + 2]);
}
long long check(int x, int y, int p, int l, int r) {
  if (l == x && r == y) return st[p];
  int mid = (l + r) >> 1;
  long long res = -1;
  if (x <= mid) res = max(res, check(x, min(y, mid), 2 * p + 1, l, mid));
  if (mid + 1 <= y)
    res = max(res, check(max(mid + 1, x), y, 2 * p + 2, mid + 1, r));
  return res;
}
int find(int x, int p, int l, int r) {
  if (l == r) return l;
  int mid = (l + r) >> 1;
  if (st[2 * p + 1] >= x) return find(x, 2 * p + 1, l, mid);
  return find(x, 2 * p + 2, mid + 1, r);
}
void update(int p, int l, int r, int Ind, long long val) {
  if (l == r) {
    st[p] = val;
    return;
  }
  int mid = (l + r) >> 1;
  if (Ind <= mid)
    update(2 * p + 1, l, mid, Ind, val);
  else
    update(2 * p + 2, mid + 1, r, Ind, val);
  st[p] = max(st[2 * p + 1], st[2 * p + 2]);
}
pair<int, long long> res[MAX_N];
int main() {
  int n, m;
  scanf("%d %d", &n, &m);
  a.resize(n), b.resize(m);
  for (int i = 0; i < n; i++) {
    scanf("%d %d", &a[i].first.first, &a[i].first.second);
    a[i].second = make_pair(i, 0);
  }
  for (int i = 0; i < m; i++) scanf("%d %d", &b[i].first, &b[i].second);
  sort(a.begin(), a.end());
  build(0, 0, n - 1);
  multiset<pair<int, int>> Mset;
  for (int i = 0; i < m; i++) {
    int x = b[i].first, sz = b[i].second;
    int Ind =
        (int)(lower_bound(a.begin(), a.end(),
                          make_pair(make_pair(x + 1, 0), make_pair(0, 0))) -
              a.begin());
    long long ans = -1;
    if (Ind == 0) continue;
    ans = max(ans, check(0, Ind - 1, 0, 0, n - 1));
    if (ans < x) {
      Mset.insert(make_pair(x, sz));
      continue;
    }
    int FInd = find(x, 0, 0, n - 1);
    a[FInd].first.second += sz;
    a[FInd].second.second++;
    update(0, 0, n - 1, FInd, a[FInd].first.first + a[FInd].first.second);
    while (1) {
      multiset<pair<int, int>>::iterator it =
          Mset.lower_bound(make_pair(a[FInd].first.first, 0));
      if (it == Mset.end() ||
          it->first > a[FInd].first.first + a[FInd].first.second)
        break;
      a[FInd].first.second += it->second;
      a[FInd].second.second++;
      update(0, 0, n - 1, FInd, a[FInd].first.first + a[FInd].first.second);
      Mset.erase(it);
    }
  }
  for (int i = 0; i < n; i++) {
    res[a[i].second.first].first = a[i].second.second;
    res[a[i].second.first].second = a[i].first.second;
  }
  for (int i = 0; i < n; i++) {
    cout << res[i].first << " " << res[i].second << endl;
  }
}
