#include <bits/stdc++.h>
using namespace std;
vector<int> compress(vector<int> &v) {
  vector<int> a = v;
  sort((a).begin(), (a).end());
  a.erase(unique((a).begin(), (a).end()), a.end());
  for (auto &(b) : (v)) b = lower_bound((a).begin(), (a).end(), b) - a.begin();
  return a;
}
template <class T = int>
class SegmentTree {
 public:
  SegmentTree() {}
  SegmentTree(int n_, T init_) : n(1), init(init_) {
    for (; n < n_; n <<= 1)
      ;
    dat = vector<T>(n << 1, init);
    for (int i = 0; i < n << 1; ++i) dat[i] = init;
  }
  void update(int k, T a) {
    k += n;
    dat[k] = a;
    while (k > 1) {
      k >>= 1;
      dat[k] = cal(dat[k << 1], dat[(k << 1) | 1]);
    }
  }
  T query(int a, int b) { return query(a, b, 1, 0, n); }

 private:
  int n;
  T init;
  vector<T> dat;
  T cal(T a, T b) { return max(a, b); }
  T query(int a, int b, int k, int l, int r) {
    if (r <= a || b <= l) return init;
    if (a <= l && r <= b)
      return dat[k];
    else {
      T vl, vr;
      vl = query(a, b, k << 1, l, (l + r) >> 1);
      vr = query(a, b, (k << 1) | 1, (l + r) >> 1, r);
      return cal(vl, vr);
    }
  }
};
int n, m;
SegmentTree<pair<long long, int>> st;
bool check(int r, int pos) {
  auto val = st.query(0, r);
  return val.first >= pos;
}
int main() {
  while (scanf("%d%d", &n, &m) != EOF) {
    vector<int> x(n), t(n), p(m), b(m);
    for (int i = 0; i < (int)n; ++i) scanf("%d%d", &x[i], &t[i]);
    for (int i = 0; i < (int)m; ++i) scanf("%d%d", &p[i], &b[i]);
    vector<int> v = compress(x);
    st = SegmentTree<pair<long long, int>>(n, make_pair(-1, -1));
    for (int i = 0; i < (int)n; ++i)
      st.update(x[i], make_pair(v[x[i]] + t[i], i));
    vector<pair<int, long long>> ans(n);
    multiset<pair<int, int>> ms;
    for (int i = 0; i < (int)m; ++i) {
      int L = 0, R = upper_bound((v).begin(), (v).end(), p[i]) - v.begin(), M;
      while (R - L > 1) {
        M = (L + R) / 2;
        (check(M, p[i]) ? R : L) = M;
      }
      if (check(R, p[i])) {
        auto li = st.query(0, R);
        long long tt = li.first;
        int frog = li.second, xx = v[x[frog]];
        tt += b[i];
        ans[frog].first++;
        ans[frog].second += b[i];
        int up = 1;
        while (up) {
          up = 0;
          auto it = ms.lower_bound(make_pair(xx, 0));
          if (it != ms.end() && it->first <= tt) {
            up = 1;
            tt += it->second;
            ans[frog].first++;
            ans[frog].second += it->second;
            ms.erase(it);
          }
        }
        st.update(x[frog], make_pair(tt, frog));
      } else {
        ms.insert(make_pair(p[i], b[i]));
      }
    }
    for (int i = 0; i < (int)n; ++i) {
      ans[i].second += t[i];
      printf("%d %I64d\n", ans[i].first, ans[i].second);
    }
  }
}
