Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests.
If you've seen these problems, a virtual contest is not for you - solve these problems in the archive.
If you just want to solve some problem from a contest, a virtual contest is not for you - solve this problem in the archive.
Never use someone else's code, read the tutorials or communicate with other person during a virtual contest.

No tag edit access

F. Frogs and mosquitoes

time limit per test

2 secondsmemory limit per test

512 megabytesinput

standard inputoutput

standard outputThere are *n* frogs sitting on the coordinate axis *Ox*. For each frog two values *x* _{ i}, *t* _{ i} are known — the position and the initial length of the tongue of the *i*-th frog (it is guaranteed that all positions *x* _{ i} are different). *m* mosquitoes one by one are landing to the coordinate axis. For each mosquito two values are known *p* _{ j} — the coordinate of the position where the *j*-th mosquito lands and *b* _{ j} — the size of the *j*-th mosquito. Frogs and mosquitoes are represented as points on the coordinate axis.

The frog can eat mosquito if mosquito is in the same position with the frog or to the right, and the distance between them is not greater than the length of the tongue of the frog.

If at some moment several frogs can eat a mosquito the leftmost frog will eat it (with minimal *x* _{ i}). After eating a mosquito the length of the tongue of a frog increases with the value of the size of eaten mosquito. It's possible that after it the frog will be able to eat some other mosquitoes (the frog should eat them in this case).

For each frog print two values — the number of eaten mosquitoes and the length of the tongue after landing all mosquitoes and after eating all possible mosquitoes by frogs.

Each mosquito is landing to the coordinate axis only after frogs eat all possible mosquitoes landed before. Mosquitoes are given in order of their landing to the coordinate axis.

Input

First line contains two integers *n*, *m* (1 ≤ *n*, *m* ≤ 2·10^{5}) — the number of frogs and mosquitoes.

Each of the next *n* lines contains two integers *x* _{ i}, *t* _{ i} (0 ≤ *x* _{ i}, *t* _{ i} ≤ 10^{9}) — the position and the initial length of the tongue of the *i*-th frog. It is guaranteed that all *x* _{ i} are different.

Next *m* lines contain two integers each *p* _{ j}, *b* _{ j} (0 ≤ *p* _{ j}, *b* _{ j} ≤ 10^{9}) — the position and the size of the *j*-th mosquito.

Output

Print *n* lines. The *i*-th line should contain two integer values *c* _{ i}, *l* _{ i} — the number of mosquitoes eaten by the *i*-th frog and the length of the tongue of the *i*-th frog.

Examples

Input

4 6

10 2

15 0

6 1

0 1

110 10

1 1

6 0

15 10

14 100

12 2

Output

3 114

1 10

1 1

1 2

Input

1 2

10 2

20 2

12 1

Output

1 3

Codeforces (c) Copyright 2010-2020 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: Aug/03/2020 15:46:22 (g2).

Desktop version, switch to mobile version.

Supported by

User lists

Name |
---|