2 2
0 0
30 9
6 2
19 2
 1 1
1000000000 1000000000
1000000000 1000000000
 20 20
19 1
67 10
42 0
185 1
68 2
88 0
74 3
138 2
30 5
112 8
1 1
137 0
125 0
106 5
145 0
188 2
166 11
49 1
171 5
15 0
166 1
171 1
29 1
190 1
76 1
146 1
84 1
169 1
58 1
111 1
81 1
33 1
144 1
182 0
44 0
63 1
176 1
68 1
184 1
147 1
 20 20
87 2
77 3
88 5
54 3
49 1
114 1
103 0
173 0
126 0
28 6
144 6
191 6
14 4
44 4
19 1
165 9
5 1
183 3
113 9
147 3
47 1
45 0
34 1
191 0
199 1
154 1
163 1
142 0
54 1
136 1
167 1
151 1
166 1
108 1
79 1
172 0
76 1
74 1
31 1
95 1
 10 10
33 2
922 34
480 105
844 5
739 39
325 20
999 88
462 104
225 5
93 4
13 15
323 9
152 20
785 11
512 4
859 8
327 14
818 9
794 13
99 20
 20 20
71 3
168 4
112 2
49 3
140 0
32 1
17 1
9 1
180 2
84 0
47 2
134 0
58 1
75 1
0 3
107 7
161 6
143 3
183 5
121 4
190 1
140 1
83 0
174 0
192 1
119 0
164 1
79 1
31 1
17 1
125 1
18 1
136 0
115 1
133 1
40 0
181 1
25 1
114 1
113 1
 2 2
0 19
29 6
5 3
17 3
 2 2
1 6
26 24
20 2
1 2
 2 2
9 1
0 19
17 3
18 3
 2 2
32 0
0 9
14 2
10 3
 2 2
0 11
19 9
8 2
16 2
 2 2
23 3
5 4
1 3
11 3
 20 20
52 0
126 2
197 1
28 4
69 2
88 7
78 3
105 1
157 2
143 0
16 4
182 6
104 10
171 2
36 1
64 7
0 3
118 1
13 0
153 0
185 1
164 1
51 1
0 1
48 0
147 1
162 1
96 1
5 1
190 1
127 1
79 0
62 1
63 1
29 1
181 1
137 1
42 1
80 1
181 1
 2 2
0 1
28 18
9 2
2 1
 20 20
76 3
136 2
58 3
18 9
1 2
123 6
186 2
163 2
6 1
73 3
91 4
37 2
141 6
103 0
26 5
155 0
52 0
174 0
187 8
104 7
33 1
173 1
138 1
2 1
106 1
155 1
101 0
168 1
114 1
98 0
72 1
120 1
43 1
73 1
25 1
183 1
177 0
54 1
179 1
131 1
 2 2
0 16
15 12
5 2
8 3
 20 20
177 4
62 0
45 7
190 0
134 0
49 0
158 6
71 0
113 3
106 4
152 1
103 0
27 2
76 1
28 1
10 8
0 0
173 9
135 10
94 3
15 1
33 1
122 1
136 1
17 1
85 1
95 1
41 1
133 1
136 0
150 1
126 1
21 1
200 1
102 0
177 1
89 1
161 1
178 1
114 1
 20 20
150 4
138 3
95 0
25 1
80 0
72 3
127 7
29 1
153 5
174 4
197 1
170 4
104 0
11 1
41 4
67 4
48 5
119 3
94 6
6 3
25 0
91 1
18 0
120 1
45 1
177 1
80 1
174 1
136 1
182 1
97 1
116 1
114 1
119 1
114 1
46 1
31 1
186 1
123 1
169 1
 20 20
77 6
0 3
68 1
25 4
179 5
27 0
187 0
159 4
11 2
53 1
107 3
106 0
48 7
150 3
131 4
171 5
43 2
124 5
136 3
90 5
153 1
75 1
178 1
1 0
148 1
19 1
15 1
116 1
174 1
191 1
80 0
44 1
122 1
136 1
35 1
11 1
40 0
7 1
186 1
191 1
 2 2
34 1
0 5
2 2
19 0
 20 20
81 6
77 2
22 1
155 3
94 0
110 2
11 5
116 2
156 5
167 2
31 3
47 5
3 4
194 3
177 6
83 0
124 10
48 0
147 0
64 3
88 0
146 1
66 1
82 1
167 1
53 1
161 1
177 1
187 0
40 1
182 0
128 1
172 1
155 0
157 1
166 1
96 1
146 1
36 1
125 1
 20 20
19 5
186 3
32 3
46 2
74 2
114 1
162 3
3 8
87 3
101 0
4 1
127 0
157 6
128 8
147 3
189 1
52 11
61 1
175 0
70 2
65 1
143 1
82 1
110 1
162 1
150 1
29 1
4 1
186 1
132 1
166 1
183 1
44 1
59 1
192 1
146 1
83 1
140 1
75 1
101 1

0 0
0 9
 1 2000000000
 0 1
2 12
0 0
0 1
0 2
0 0
0 3
0 2
1 6
0 8
0 1
0 0
0 0
1 6
0 0
1 3
4 15
0 1
0 5
0 0
 0 2
1 4
0 5
1 4
0 1
0 1
0 0
0 0
0 0
2 8
0 6
1 6
0 4
2 5
0 1
3 11
0 1
0 3
0 9
0 3
 0 2
0 34
0 105
0 5
0 39
1 34
0 88
1 108
0 5
0 4
 0 3
0 4
0 2
0 3
1 1
0 1
2 3
0 1
1 3
0 0
0 2
0 0
0 1
0 1
0 3
3 10
1 7
0 3
0 5
1 5
 2 25
0 6
 1 8
0 24
 0 1
2 25
 0 0
0 9
 1 13
0 9
 0 3
0 4
 0 0
1 3
0 1
1 5
0 2
0 7
2 4
0 1
0 2
0 0
0 4
1 7
0 10
0 2
0 1
0 7
1 4
0 1
0 0
0 0
 0 1
0 18
 0 3
1 3
0 3
1 10
1 3
0 6
0 2
0 2
0 1
1 4
0 4
0 2
0 6
0 0
0 5
1 1
0 0
0 0
0 8
1 8
 2 21
0 12
 0 4
0 0
0 7
0 0
0 0
0 0
1 7
0 0
1 4
0 4
0 1
0 0
0 2
0 1
0 1
2 10
0 0
2 11
2 11
1 4
 0 4
0 3
0 0
1 1
1 1
0 3
0 7
0 1
0 5
1 5
0 1
1 5
0 0
0 1
2 6
0 4
0 5
3 6
1 7
0 3
 1 6
1 3
0 1
0 4
0 5
0 0
0 0
0 4
1 3
0 1
0 3
0 0
0 7
1 4
0 4
1 6
1 3
0 5
1 4
0 5
 0 1
1 7
 2 7
0 2
0 1
2 4
0 0
0 2
0 5
0 2
1 6
1 3
0 3
0 5
0 4
0 3
2 7
0 0
2 12
0 0
0 0
1 4
 0 5
1 4
0 3
0 2
1 3
0 1
0 3
1 9
0 3
1 1
0 1
0 0
1 7
1 9
1 4
0 1
1 12
0 1
0 0
0 2

#include <bits/stdc++.h>
using namespace std;
const long double EPS = 1e-9;
const long double PI = atan(1) * 4;
const long long M = 1000000007;
struct PT {
  double x, y;
  PT() {}
  PT(double x, double y) : x(x), y(y) {}
  PT(const PT &p) : x(p.x), y(p.y) {}
  PT operator+(const PT &p) const { return PT(x + p.x, y + p.y); }
  PT operator-(const PT &p) const { return PT(x - p.x, y - p.y); }
  PT operator*(double c) const { return PT(x * c, y * c); }
  PT operator/(double c) const { return PT(x / c, y / c); }
};
double dot(PT p, PT q) { return p.x * q.x + p.y * q.y; }
double dist2(PT p, PT q) { return dot(p - q, p - q); }
double cross(PT p, PT q) { return p.x * q.y - p.y * q.x; }
double cos_u2v(const PT &u, const PT &v) {
  return dot(u, v) / sqrt(dot(u, u) * dot(v, v));
}
double sin_u2v(const PT &u, const PT &v) {
  return cross(u, v) / sqrt(dot(u, u) * dot(v, v));
}
ostream &operator<<(ostream &os, const PT &p) {
  os << "(" << p.x << "," << p.y << ")";
}
double vector2angle(const PT &v) { return atan2(v.y, v.x); }
struct UnionFind {
  vector<long long> C;
  UnionFind(long long n) : C(n) {
    for (int i = 0; i < n; i++) C[i] = i;
  }
  long long find(long long x) { return (C[x] == x) ? x : C[x] = find(C[x]); }
  void merge(long long x, long long y) { C[find(x)] = find(y); }
};
long long mod(long long x, long long m) { return ((x % m) + m) % m; }
long long gcd(long long a, long long b) {
  for (; b > 0; swap(a, b)) a %= b;
  return a;
}
long long extended_euclid(long long a, long long b, long long &x,
                          long long &y) {
  long long xx = y = 0;
  long long yy = x = 1;
  while (b) {
    long long q = a / b;
    long long t = b;
    b = a % b;
    a = t;
    t = xx;
    xx = x - q * xx;
    x = t;
    t = yy;
    yy = y - q * yy;
    y = t;
  }
  return a;
}
long long mod_inverse(long long a, long long n) {
  long long x, y;
  long long d = extended_euclid(a, n, x, y);
  if (d > 1) return -1;
  return mod(x, n);
}
struct LPSolver {
  int m, n;
  vector<long long> B, N;
  vector<vector<long double>> D;
  LPSolver(const vector<vector<long double>> &A, const vector<long double> &b,
           const vector<long double> &c)
      : m(b.size()),
        n(c.size()),
        N(n + 1),
        B(m),
        D(m + 2, vector<long double>(n + 2)) {
    for (int i = 0; i < m; i++)
      for (int j = 0; j < n; j++) D[i][j] = A[i][j];
    for (int i = 0; i < m; i++) {
      B[i] = n + i;
      D[i][n] = -1;
      D[i][n + 1] = b[i];
    }
    for (int j = 0; j < n; j++) {
      N[j] = j;
      D[m][j] = -c[j];
    }
    N[n] = -1;
    D[m + 1][n] = 1;
  }
  void Pivot(int r, int s) {
    for (int i = 0; i < m + 2; i++)
      if (i != r)
        for (int j = 0; j < n + 2; j++)
          if (j != s) D[i][j] -= D[r][j] * D[i][s] / D[r][s];
    for (int j = 0; j < n + 2; j++)
      if (j != s) D[r][j] /= D[r][s];
    for (int i = 0; i < m + 2; i++)
      if (i != r) D[i][s] /= -D[r][s];
    D[r][s] = 1.0 / D[r][s];
    swap(B[r], N[s]);
  }
  bool Simplex(int phase) {
    int x = phase == 1 ? m + 1 : m;
    while (true) {
      int s = -1;
      for (int j = 0; j <= n; j++) {
        if (phase == 2 && N[j] == -1) continue;
        if (s == -1 || D[x][j] < D[x][s] || D[x][j] == D[x][s] && N[j] < N[s])
          s = j;
      }
      if (D[x][s] > -EPS) return true;
      int r = -1;
      for (int i = 0; i < m; i++) {
        if (D[i][s] < EPS) continue;
        if (r == -1 || D[i][n + 1] / D[i][s] < D[r][n + 1] / D[r][s] ||
            (D[i][n + 1] / D[i][s]) == (D[r][n + 1] / D[r][s]) && B[i] < B[r])
          r = i;
      }
      if (r == -1) return false;
      Pivot(r, s);
    }
  }
  long double solve(vector<long double> &x) {
    int r = 0;
    for (int i = 1; i < m; i++)
      if (D[i][n + 1] < D[r][n + 1]) r = i;
    if (D[r][n + 1] < -EPS) {
      Pivot(r, n);
      if (!Simplex(1) || D[m + 1][n + 1] < -EPS)
        return -numeric_limits<long double>::infinity();
      for (int i = 0; i < m; i++)
        if (B[i] == -1) {
          int s = -1;
          for (int j = 0; j <= n; j++)
            if (s == -1 || D[i][j] < D[i][s] ||
                D[i][j] == D[i][s] && N[j] < N[s])
              s = j;
          Pivot(i, s);
        }
    }
    if (!Simplex(2)) return numeric_limits<long double>::infinity();
    x = vector<long double>(n);
    for (int i = 0; i < m; i++)
      if (B[i] < n) x[B[i]] = D[i][n + 1];
    return D[m][n + 1];
  }
};
void edgelist2adjlists(long long n, const vector<long long> &froms,
                       const vector<long long> &tos, vector<long long> &v2e0,
                       vector<long long> &e2n) {
  v2e0.resize(n);
  v2e0.assign(n, -1);
  long long en = froms.size();
  e2n.resize(en);
  for (int i = 0; i < en; i++) {
    long long f = froms[i];
    long long t = tos[i];
    e2n[i] = v2e0[f];
    v2e0[f] = i;
  }
}
struct FordFulk {
 private:
  const vector<long long> &v2e0;
  const vector<long long> &e2f;
  const vector<long long> &e2t;
  const vector<long long> &e2c;
  const vector<long long> &e2n;
  long long s, t;
  long long find_aug_path(const vector<long long> &v2e0,
                          const vector<long long> &e2f,
                          const vector<long long> &e2t,
                          const vector<long long> &e2c,
                          const vector<long long> &e2n, long long s,
                          long long t, vector<long long> &epath) {
    vector<long long> q2v;
    vector<long long> q2p;
    vector<long long> q2e;
    vector<long long> q2f;
    vector<bool> inq(v2e0.size(), false);
    q2v.push_back(s);
    q2p.push_back(-1);
    q2e.push_back(-1);
    q2f.push_back(INT_MAX);
    inq[s] = true;
    for (long long i = 0; i < q2v.size(); i++) {
      long long crt = q2v[i];
      long long f = q2f[i];
      for (long long j = v2e0[crt]; j != -1; j = e2n[j]) {
        long long to = e2t[j];
        long long rem = e2c[j];
        if (inq[to]) continue;
        if (rem <= 0) continue;
        q2v.push_back(to);
        q2p.push_back(i);
        q2e.push_back(j);
        q2f.push_back(min(f, rem));
        inq[to] = true;
      }
    }
    for (long long i = 0; i < q2v.size(); i++) {
      if (q2v[i] != t) continue;
      stack<long long> stk;
      for (long long j = i; j > 0; j = q2p[j]) {
        stk.push(q2e[j]);
      }
      while (!stk.empty()) {
        epath.push_back(stk.top());
        stk.pop();
      }
      return q2f[i];
    }
    return 0;
  }

 public:
  FordFulk(const vector<long long> &_v2e0, const vector<long long> &_e2f,
           const vector<long long> &_e2t, const vector<long long> &_e2c,
           const vector<long long> &_e2n, long long _s, long long _t)
      : s(_s), t(_t), v2e0(_v2e0), e2f(_e2f), e2t(_e2t), e2c(_e2c), e2n(_e2n) {}
  long long eval() {
    long long en = e2f.size();
    map<pair<long long, long long>, long long> rsd;
    for (long long i = 0; i < en; i++) {
      long long f = e2f[i];
      long long t = e2t[i];
      rsd[make_pair(f, t)] += e2c[i];
      rsd[make_pair(t, f)] += 0;
    }
    map<pair<long long, long long>, long long> nei;
    long long ren = 0;
    for (auto er : rsd) {
      nei[er.first] = ren++;
    }
    long long rvn = v2e0.size();
    vector<long long> rv2e0(rvn, -1);
    vector<long long> re2f(ren);
    vector<long long> re2t(ren);
    vector<long long> re2c(ren);
    vector<long long> re2n(ren);
    vector<long long> re2p(ren);
    long long rei = 0;
    for (auto er : rsd) {
      long long f = er.first.first;
      long long t = er.first.second;
      long long c = er.second;
      re2f[rei] = f;
      re2t[rei] = t;
      re2c[rei] = c;
      re2p[rei] = nei[make_pair(t, f)];
      re2n[rei] = rv2e0[f];
      rv2e0[f] = rei;
      ++rei;
    }
    long long sol = 0;
    vector<long long> epath;
    while (true) {
      epath.clear();
      long long res = find_aug_path(rv2e0, re2f, re2t, re2c, re2n, s, t, epath);
      if (res == 0) break;
      for (auto ei : epath) {
        re2c[ei] -= res;
        re2c[re2p[ei]] += res;
      }
      sol += res;
    }
    return sol;
  }
};
struct LazySegTree {
  long long l;
  long long r;
  int val;
  int to_push;
  LazySegTree *lchd;
  LazySegTree *rchd;
  LazySegTree(long long _l, long long _r, int _v)
      : l(_l), r(_r), val(_v), to_push(_v), lchd(NULL), rchd(NULL) {}
  void set(long long l1, long long r1, int v1) {
    assert(l1 >= l && r1 <= r);
    val = min(val, v1);
    if (l == l1 && r == r1) {
      to_push = min(to_push, v1);
      return;
    }
    long long m = (l + r) / 2;
    if (lchd == NULL) {
      lchd = new LazySegTree(l, m, to_push);
      rchd = new LazySegTree(m + 1, r, to_push);
    }
    lchd->set(l, m, to_push);
    rchd->set(m + 1, r, to_push);
    if (l1 <= m) lchd->set(l1, min(r1, m), v1);
    if (r1 > m) rchd->set(max(l1, m + 1), r1, v1);
  }
  int get(long long l1, long long r1) {
    assert(l1 >= l && r1 <= r);
    if (l == l1 && r == r1) {
      return val;
    }
    if (lchd == NULL) return val;
    long long m = (l + r) / 2;
    lchd->set(l, m, to_push);
    rchd->set(m + 1, r, to_push);
    bool lgood = (l1 <= m);
    long long lv = (lgood) ? lchd->get(l1, min(r1, m)) : 0;
    bool rgood = (m + 1 <= r1);
    long long rv = (rgood) ? rchd->get(max(m + 1, l1), r1) : 0;
    return (!lgood) ? rv : (!rgood) ? lv : min(lv, rv);
  }
};
void readll(long long &x) {
  int r;
  scanf("%d", &r);
  x = r;
}
int main() {
  long long n, m;
  readll(n);
  readll(m);
  vector<long long> x(n);
  vector<long long> t(n);
  vector<long long> kil(n);
  vector<pair<long long, long long>> xi(n);
  long long maxreach = 0;
  long long fmax = 0;
  long long mmax = 0;
  for (long long i = 0; i < n; i++) {
    readll(x[i]);
    readll(t[i]);
    xi[i] = make_pair(x[i], i);
    fmax = max(fmax, x[i] + t[i]);
  }
  sort(xi.begin(), xi.end());
  vector<long long> p(m);
  vector<long long> b(m);
  for (long long i = 0; i < m; i++) {
    readll(p[i]);
    readll(b[i]);
    mmax = max(mmax, p[i]);
    fmax += b[i];
  }
  LazySegTree tree(0, max(fmax, mmax), n);
  for (long long i = 0; i < n; i++) {
    long long fgi = xi[i].second;
    long long x0 = x[fgi];
    long long x1 = x[fgi] + t[fgi];
    tree.set(x0, x1, i);
  }
  map<long long, long long> p2t;
  map<long long, long long> p2c;
  for (long long i = 0; i < m; i++) {
    p2t[p[i]] += b[i];
    p2c[p[i]]++;
    auto itt = p2t.find(p[i]);
    auto itc = p2c.find(p[i]);
    while (true) {
      if (itt == p2t.end()) {
        assert(itc == p2c.end());
        break;
      }
      long long pos = itt->first;
      long long j = tree.get(pos, pos);
      if (j == n) break;
      long long fgi = xi[j].second;
      kil[fgi] += itc->second;
      t[fgi] += itt->second;
      tree.set(x[fgi], x[fgi] + t[fgi], j);
      itt = p2t.erase(itt);
      itc = p2c.erase(itc);
    }
  }
  for (long long i = 0; i < n; i++) {
    int ti = t[i];
    int ki = kil[i];
    printf("%d %d\n", ki, ti);
  }
  return 0;
}
