#include <bits/stdc++.h>
using namespace std;
pair<long long, long long> arr[200010];
map<long long, long long> mark;
long long tree[1 << 19], cnt[200010], n, m, a, b, value, ans[200010];
multiset<pair<long long, long long>> st;
inline void build(long long n, long long l, long long r) {
  if (l == r) {
    tree[n] = arr[l].first + arr[r].second;
    return;
  }
  long long mid = l + r >> 1;
  build(2 * n, l, mid);
  build(2 * n + 1, mid + 1, r);
  tree[n] = max(tree[2 * n], tree[2 * n + 1]);
}
inline long long query(long long n, long long l, long long r, long long ql,
                       long long qr, long long val) {
  if (l > qr || r < ql || tree[n] < val) return -1;
  if (l == r) {
    value = tree[n];
    return l;
  }
  long long mid = l + r >> 1;
  long long ret = query(2 * n, l, mid, ql, qr, val);
  if (ret == -1) ret = query(2 * n + 1, mid + 1, r, ql, qr, val);
  return ret;
}
inline void update(long long n, long long l, long long r, long long pos,
                   long long val) {
  if (l == r) {
    tree[n] = val;
    return;
  }
  long long mid = l + r >> 1;
  if (pos <= mid)
    update(2 * n, l, mid, pos, val);
  else
    update(2 * n + 1, mid + 1, r, pos, val);
  tree[n] = max(tree[2 * n], tree[2 * n + 1]);
}
inline void rec(long long n, long long l, long long r) {
  if (l == r) {
    ans[mark[arr[l].first]] = tree[n] - arr[l].first;
    return;
  }
  long long mid = l + r >> 1;
  rec(2 * n, l, mid);
  rec(2 * n + 1, mid + 1, r);
}
int main() {
  scanf("%lld", &n);
  ;
  scanf("%lld", &m);
  ;
  for (long long x = 1; x <= n; x++) {
    scanf("%lld", &arr[x].first);
    ;
    scanf("%lld", &arr[x].second);
    ;
    mark[arr[x].first] = x;
  }
  sort(arr + 1, arr + n + 1);
  build(1, 1, n);
  while (m--) {
    scanf("%lld", &a);
    ;
    scanf("%lld", &b);
    ;
    if (a < arr[1].first) continue;
    long long idx1 =
        lower_bound(arr + 1, arr + n + 1, make_pair(a, 100000000000000LL)) -
        arr - 1;
    long long idx2 = query(1, 1, n, 1, idx1, a);
    if (idx2 == -1) {
      st.insert(make_pair(a, b));
      continue;
    }
    value += b;
    ++cnt[mark[arr[idx2].first]];
    while (!st.empty()) {
      auto it = st.lower_bound(make_pair(arr[idx2].first, 100000000000000LL));
      if (it == st.end()) break;
      if (it->first <= value) {
        value += it->second;
        ++cnt[mark[arr[idx2].first]];
        st.erase(it);
      } else
        break;
    }
    update(1, 1, n, idx2, value);
  }
  rec(1, 1, n);
  for (int x = 1; x <= n; x++) printf("%lld %lld\n", cnt[x], ans[x]);
}
