Prof. Pang has rectangles, the coordinate of the lower left corner of the -th rectangle is , and the coordinate of the upper right corner is . Rectangles may overlap.
You need to choose three straight lines such that:
Each line should be parallel to the -axis or the -axis, which means its formula is or .
In the formula or , should be an integer in .
These three lines should be distinct.
Each rectangle is by at least one line. A line touches a rectangle if it intersects with the boundary and/or the interior of the rectangle.
You need to compute the number of ways to choose three lines. Since the answer can be very large, output it modulo . Two ways are considered the same if only the order of three lines differs in these two ways.
输入格式
The first line contains a single integer , denoting the number of test cases.
For each test case, the first line contains an integer . The -th line of the next lines contains four integers .
It is guaranteed that the sum of over all test cases does not exceed .
输出格式
For each test case, output one integer representing the answer in one line.