The first line of the input file contains an integerT(≤5), which indicates the number of test cases.
For each test case, there are n+m+1 lines in the input file.
The first line of each test case contains 2 integers nn and mm, which indicate the number of GTs and the number of emitting energy, respectively.(1≤n,m≤50000)
In the following nn lines, the i−th line contains two integers a?i?? and b?i??, which indicate the group of the i−th GT and his value of ability, respectively. (0≤a?i??≤1,1≤b?i??≤10^?6??)
In the following mm lines, the i−th line contains an integer c?i??, which indicates the time of emitting energy for i−th time.