The input contains several test cases.
The first line contains two integers N and M. N is the number of the machines.M is the number of tasks.
The following N lines each contains two integers,
.
is the maximum time the machine can work.
is the level of the machine.
The following M lines each contains two integers,
.xi is the time we need to complete the task.yi is the level of the task.
For each test case, output two integers, the maximum number of the tasks which the company can complete today and the money they will get.