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 ai and bi, which indicate the group of the i−th GT and his value of ability, respectively. (0≤ai≤1,1≤bi≤10^6)
In the following mm lines, the i−th line contains an integer ci, which indicates the time of emitting energy for i−th time.