The first line contains a single integer T, indicating the number of test cases.
Each test case begins with four integers N, M, X, Y indicate the number of the stars, the number of the buildings, and the coordinates of Dumbear and Jing on the ground.
Then N lines follow, each line contains three integers Xi, Yi, Zi indicate a star’s direction. If your location is (x, y) on the ground, then the star will be in the direction (x, y, 0) => (x + Xi, y + Yi, Zi). Note that the most beautiful star is always the first.
Then M lines follow, each line contains five integers X1i, Y1i, X2i, Y2i, Hi indicate the building’s lower left coordinates, upper right coordinates on the ground and the height of it.
Technical Specification
1. 1 <= T <= 10020
2. 1 <= N <= 1000 Note for more than 99% of the test cases, 1 <= N <= 10
3. 1 <= M <= 20 Note for more than 99% of the test cases, 1 <= M <= 5
4. 0 <= |X|, |Y|, |Xi|, |Yi|, |X1i|, |Y1i|, |X2i|, |Y2i| <= 1000
5. X1i < X2i, Y1i < Y2i, 10 <= Zi, Hi <= 100