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

/*
	Author: Valeria Montagna
	

	Solution Description:


	Complexity: 

*/

#include <iostream>
#include <map>
#include <vector>

bool debug = false;

template <typename T>
struct BinarySearchTree {

	BinarySearchTree();

	BinarySearchTree(size_t size){
		v1.reserve(size);
	}

	struct bst
	{
	    T data;
	    int leftIdx;
	    int rightIdx;
	};

	int getN(){
		return v1.size();
	}

	void MakeNode(int aData)
	{
	    bst b1 = { aData, -1, -1 };
	    v1.push_back(b1);
	}

	void setleft(int currIndex, T aData)
	{
	    unsigned int leftIndex = v1.size();
	    v1[currIndex].leftIdx = leftIndex;
	    bst b1 = { aData, -1, -1 };
	    v1.push_back(b1);
	}

	void setright(int currIndex, T aData)
	{
	    unsigned int rightIndex = v1.size();
	    v1[currIndex].rightIdx = rightIndex;
	    bst b1 = { aData, -1, -1 };
	    v1.push_back(b1);
	}

	void Insert(T aData)
	{
	    if(v1.size() == 0)
	    {
	       	MakeNode(aData);
	        return;
	    }
	    unsigned int currentIdx = 0;
	    while ( currentIdx < v1.size() )
	    {
	        if(aData <= v1[currentIdx].data)
	        {
	            if( v1[currentIdx].leftIdx == -1)
	            {
	                setleft(currentIdx, aData);
	                break;
	            }
	            else
	                currentIdx = v1[currentIdx].leftIdx;
	        }
	        else
	        {
	            if(v1[currentIdx].rightIdx == -1)
	            {
	                setright(currentIdx, aData);
	                break;
	            }
	            else
	                currentIdx = v1[currentIdx].rightIdx;
	        }
	    }
	}

	int findMinimum(int currentIdx)
	{
		while((currentIdx = v1[currentIdx].leftIdx) != -1);

		return currentIdx;
	}

	void findPredecessorOrHimself(T elem, T &pre){
		if(v1.size() == 0)
			return;


		int currentIdx = 0;

		while(currentIdx < v1.size()){


			if(v1[currentIdx].data == elem){
				pre = v1[currentIdx].data;
				if(v1[currentIdx].leftIdx != -1){
					int preIdx = v1[currentIdx].leftIdx;
					pre = v1[preIdx].data;

					while(v1[preIdx].rightIdx != -1) {
						preIdx = v1[preIdx].rightIdx;
						pre = v1[preIdx].data;
					}

				}

				return;
			}

			if(v1[currentIdx].data < elem){
				pre = v1[currentIdx].data;
				currentIdx = v1[currentIdx].rightIdx;
			}
			else{
				currentIdx = v1[currentIdx].leftIdx;
			}

		}

		return;
	}

	void findPredecessor(T elem, T &pre){
		if(v1.size() == 0)
			return;


		int currentIdx = 0;

		while(currentIdx < v1.size()){


			if(v1[currentIdx].data == elem){
				if(v1[currentIdx].leftIdx != -1){
					int preIdx = v1[currentIdx].leftIdx;
					pre = v1[preIdx].data;

					while(v1[preIdx].rightIdx != -1) {
						preIdx = v1[preIdx].rightIdx;
						pre = v1[preIdx].data;
					}

				}

				return;
			}

			if(v1[currentIdx].data < elem){
				pre = v1[currentIdx].data;
				currentIdx = v1[currentIdx].rightIdx;
			}
			else{
				currentIdx = v1[currentIdx].leftIdx;
			}

		}

		return;
	}

	void findSuccessor(T elem, T &succ){
		if(v1.size() == 0)
			return;

		int currentIdx = 0;

		while(currentIdx < v1.size()){

			if(v1[currentIdx].data == elem){
				if(v1[currentIdx].rightIdx != -1){
					int succIdx = v1[currentIdx].rightIdx;
					succ = v1[succIdx].data;

					while(v1[succIdx].leftIdx != -1){
						succIdx = v1[succIdx].leftIdx;
						succ = v1[succIdx].data;
					}
				}

				return;
			}

			if(v1[currentIdx].data > elem){
				succ = v1[currentIdx].data;
				currentIdx = v1[currentIdx].leftIdx;
			}
			else{
				currentIdx = v1[currentIdx].rightIdx;
			}

		}

		return;
	}

	void Delete(T aData)
	{
		unsigned int currentIdx = 0;
		bst* parent = nullptr;

		while(currentIdx < v1.size())
		{
			if(aData < v1[currentIdx].data) // Go to the left
			{
				parent = &v1[currentIdx];
				currentIdx = v1[currentIdx].leftIdx;
			}
			else if(aData > v1[currentIdx].data) // Go to the right
			{
				parent = &v1[currentIdx];
				currentIdx = v1[currentIdx].rightIdx;
			}
			else
			{
				if(v1[currentIdx].leftIdx == -1 && v1[currentIdx].rightIdx == -1) 	  // No childs
				{
					v1.erase(v1.begin() + currentIdx);
					if(parent->leftIdx == currentIdx)
						parent->leftIdx = -1;
					else
						parent->rightIdx = -1;

					break;
				}
				else if(v1[currentIdx].leftIdx == -1 && v1[currentIdx].rightIdx != -1) // Only one right child
				{
					parent->rightIdx = v1[currentIdx].rightIdx;
					v1.erase(v1.begin() + currentIdx);

					break;
				}
				else if(v1[currentIdx].leftIdx != -1 && v1[currentIdx].rightIdx == -1) // Only one left child
				{
					parent->leftIdx = v1[currentIdx].leftIdx;
					v1.erase(v1.begin() + currentIdx);

					break;
				}
				else{																   // Both childs

					// Find in-order successor node
					int successorIxd = findMinimum(v1[currentIdx].rightIdx);

					// Replace current node's data with successor's data and delete successor
					v1[currentIdx].data = v1[successorIxd].data;
					v1.erase(v1.begin() + successorIxd);

					break;
				}	
			}
		}
	}

	void InTrav(unsigned int Idx)
	{
	    if(v1[Idx].leftIdx != -1)
	        InTrav(v1[Idx].leftIdx );
	    std::cout << v1[Idx].data << std::endl;
	    if( v1[Idx].rightIdx != -1)
	        InTrav(v1[Idx].rightIdx);
	}

	void PreTrav(unsigned int Idx)
	{
	    std::cout << v1[Idx].data << std::endl;
	    if(v1[Idx].leftIdx != -1)
	        PreTrav(v1[Idx].leftIdx );
	    if( v1[Idx].rightIdx != -1)
	        PreTrav(v1[Idx].rightIdx);
	}
	void PostTrav(unsigned int Idx)
	{
	    if(v1[Idx].leftIdx != -1)
	        PostTrav(v1[Idx].leftIdx );
	    if( v1[Idx].rightIdx != -1)
	        PostTrav(v1[Idx].rightIdx);
	    std::cout << v1[Idx].data << std::endl;
	}
	
	std::vector<bst> v1;
};
 
typedef long long ll;

struct frog
{
	ll length_t = 0;
	ll increased_t = 0;
	int eaten_m = 0;
};
struct mosquitoes
{
	int how_many = 0;
	ll total_size = 0;
};

void findEatenMosquitoes(std::map<ll, frog>& frogs, std::map<ll, mosquitoes>& mosquitoes){
	BinarySearchTree<ll> frogsPosition(frogs.size());
	std::vector<ll> frogs_updated;
	frogs_updated.reserve(frogs.size());
	std::map<ll, ll> frogsOriginalPos;

	auto it = frogs.begin();
	frogsPosition.Insert(it->first);
	frogsOriginalPos.insert({it->first, it->first});
	auto prec = it;
	++it;
	for( ; it != frogs.end(); ++it){

		if((prec->second).length_t > it->first){
			if((prec->second).length_t < (it->second).length_t) {
				frogsPosition.Insert((prec->second).length_t);
				frogsOriginalPos.insert({(prec->second).length_t, it->first});
			}
		}
		else{
			frogsPosition.Insert(it->first);
			frogsOriginalPos.insert({it->first, it->first});
		}

		prec = it;
	}	

	bool changes = true;
	while(mosquitoes.size() != 0 && changes){
		changes = false;
		for(auto it = mosquitoes.begin(); it != mosquitoes.end(); ){
			ll frog = -1;
			frogsPosition.findPredecessorOrHimself(it->first, frog);

			if(frog != -1){

				// There's a corner case in which frog position and mosquito position overlaps
				if(frog == it->first){
					ll frog_alt = -1;
					// In this case, we have to check if mosquito is reached by the real predecessor and give to him priority 
					frogsPosition.findPredecessor(it->first, frog_alt);

					if(frogs[frogsOriginalPos[frog_alt]].length_t >= it->first)
						frog = frog_alt;
				}
				ll frog_t = frog;
				frog = frogsOriginalPos[frog];

				if(frogs[frog].length_t >= it->first){
					if(debug)
						std::cout << "Frog " << frog << " eats " << (it->second).how_many << " mosquito " << it->first << " and increases his tounge (" << frogs[frog].length_t + (it->second).total_size << ")" << std::endl;
					frogs[frog].increased_t += (it->second).total_size;
					frogs[frog].eaten_m += (it->second).how_many;
					it = mosquitoes.erase(it);


					frogs_updated.push_back(frog_t);
					changes = true;
				}
				else ++it;
			} 
			else ++it;
		}

		for (int i = 0; i < frogs_updated.size(); ++i)
		{
			ll f = frogsOriginalPos[frogs_updated[i]];
			frogs[f].length_t += frogs[f].increased_t;
			frogs[f].increased_t = 0;
			ll succ = -1;
			ll curr = -1;
			bool problems = true;
			frogsPosition.findSuccessor(frogs_updated[i], succ);

			while(succ != -1 && problems){
				if(frogs[frogsOriginalPos[succ]].length_t <= frogs[f].length_t){
					if(debug)
						std::cout << "Found successor " << frogsOriginalPos[succ] << " for frog " << f << std::endl;
					frogsPosition.Delete(succ);
					frogsOriginalPos.erase(succ);
					curr = succ;
				}
				else if(frogsOriginalPos[succ] < frogs[f].length_t){
					if(debug)
						std::cout << "Successor " << frogsOriginalPos[succ] << "(" << succ << ") has to be changed into " << frogs[f].length_t << std::endl;
					auto fs = frogsOriginalPos.extract(succ);
					fs.key() = frogs[f].length_t;
					frogsOriginalPos.insert(std::move(fs));
					frogsPosition.Delete(succ);
					frogsPosition.Insert(frogs[f].length_t);
					curr = frogs[f].length_t;
				}
				else problems = false;

				succ = -1;
				frogsPosition.findSuccessor(curr, succ);
			}
		}

		frogs_updated.clear();
	}


}

int main(int argc, char const *argv[])
{
	int n = 0, m = 0;
	std::cin >> n;
	std::cin >> m;

	std::map<ll,frog> frogs;
	std::vector<ll> order;
	std::map<ll,mosquitoes> mosquitoes;

	for (int i = 0; i < n; ++i)
	{
		ll x = 0;
		ll t = 0;

		std::cin >> x;
		std::cin >> t;
		if(i == 0 && x == 83 && t == 9)
			debug = true;

		frogs.insert({x, {x + t, 0, 0}});
		order.push_back(x);
	}

	for (int i = 0; i < m; ++i)
	{
		ll p = 0;
		ll b = 0;

		std::cin >> p;
		std::cin >> b;


		auto it = mosquitoes.find(p);

		if(it != mosquitoes.end()){
			(it->second).how_many += 1;
			(it->second).total_size += b;
		}else mosquitoes.insert({p, {1, b}});
	}

	findEatenMosquitoes(frogs, mosquitoes);

	for(auto it = order.begin(); it != order.end(); ++it)
		std::cout << frogs[*it].eaten_m << " " << frogs[*it].length_t - *it << std::endl;
	return 0;
}

