We are given a figure consisting of only horizontal and vertical line
segments. Our goal is to count the number of all different rectangles
formed by these segments. As an example, the number of rectangles in the
Figures 1 and 2 are 5 and 0 respectively.
There are many intersection points in the figure. An intersection point
is a point shared by at least two segments. The input line segments are
such that each intersection point comes from the intersection of exactly
one horizontal segment and one vertical segment.输入描述
The first line of the input contains a single number M, which is the
number of test cases in the fi输出描述
The output for each test case is the number of all different rectangles
in the figure described by the test case. The output for each test case
must be written on a separate line.输入例子
2
6
0 0 0 20
0 10 25 10
20 10 20 20
0 0 10 0
10 0 10 20
0 20 20 20
3
5 0 5 20
15 5 15 25
0 10 25 10
输出例子
5
0