Segments

Time Limit: 1000 ms

Memory Limit: 65535 ms

Description

There are some segments on the plane, we assume there 4 possible position concepts for every 2 segments: no common point, countless common points, one common point and the point is also the endpoint of either segment, one common point but the point is not the endpoint of either segment.

Input

The first line of the input is an integer T, which represents that there are T test cases.An integer n indicating the number of segmentsn line follows, 4 integers per line, x1, y1, x2, y2, representing the coordinates of the endpoints of both segments .(1<=n<=100)

Output

For each test case, please output 4 line, 1 integer per lineFor the first line, please output the number of pairs of segments that have no common pointFor the second line, please output the number of pairs of segments that have countless common pointFor the third line, please output the number of pairs of segments that have 1 common point and the point is also the endpoint of either segmentFor the fourth line, please output the number of pairs of segments that have 1 common point and the point is not the endpoint.After each case output a blank line include the last case。

Sample Input

2
3
-1 0 1 0
0 -1 0 1
-1 2 1 2
3
1 0 3 0
2 0 4 0
4 0 5 0

Sample Output

2
0
0
1
1
1
1
0

Hint

None

Source

第四届北京邮电大学程序设计竞赛决赛

提交代码