#include <bits/stdc++.h>
using namespace std;
int n, m;
long long x[200010], t[200010];
long long p[200010], b[200010];
int c[200010];
map<long long, pair<long long, int>> frog;
multimap<long long, long long> mosq;
void f(long long x, long long l) {
  auto itr = frog.lower_bound(x);
  itr->second.first += l;
  long long r = itr->second.first;
  ++itr;
  while (itr != frog.end()) {
    if (itr->first <= r) {
      if (itr->second.first <= r)
        frog.erase(itr++);
      else {
        frog.insert(make_pair(r + 1, itr->second));
        frog.erase(itr);
        break;
      }
    } else
      break;
  }
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 0; i < n; i++) scanf("%lld%lld", &x[i], &t[i]);
  for (int i = 0; i < m; i++) scanf("%lld%lld", &p[i], &b[i]);
  for (int i = 0; i < n; i++) {
    frog[x[i]] = make_pair(x[i], i);
  }
  vector<pair<long long, long long>> vec;
  for (int i = 0; i < n; i++) {
    vec.push_back(make_pair(x[i], t[i]));
  }
  sort(vec.begin(), vec.end());
  reverse(vec.begin(), vec.end());
  for (auto p : vec) {
    f(p.first, p.second);
  }
  for (int i = 0; i < m; i++) {
    mosq.insert(make_pair(p[i], b[i]));
    auto itr2 = mosq.lower_bound(p[i]);
    while (itr2 != mosq.end()) {
      auto itr = frog.upper_bound(itr2->first);
      if (itr == frog.begin()) break;
      --itr;
      if (itr->second.first < itr2->first) break;
      f(itr->first, itr2->second);
      c[itr->second.second]++;
      t[itr->second.second] += itr2->second;
      mosq.erase(itr2++);
    }
  }
  for (int i = 0; i < n; i++) {
    printf("%d %lld\n", c[i], t[i]);
  }
}
