The first line contains a single integer T, indicating the number of test cases.
Each test case begins with three integers X, Y, and N. The desk’s lower left coordinates are always (0, 0) and its upper right coordinates are (X, Y). N indicates the number of things on his desk.
Then one line follows. This line contains an integer M followed by M pairs of integers. Each of the pair indicates a vertex of the convex polygon the mouse needs at least. The vertices will be given counterclockwise.
Then N lines follow, each line contains an integer L followed by L pairs of integers. Each of the pair indicates a vertex of the thing’s convex polygon. The vertices will be given counterclockwise.
Technical Specification
1. 1 <= T <= 1000
2. 0 <= N <= 20
3. 3 <= M <= 20
4. 3 <= L <= 20 and all the things are inside the desk.
5. All the coordinates will be greater than or equal to 0 and less than or equal to 10000.