D - Isolated Segments

Time Limit: 1 sec
Memory Limit: 16MB

You're given n segments in the rectangular coordinate system. The segments are defined by start and end points (Xi,Yi) and (Xj,Yj) (1 <= i, j <= n). Coordinates of these points are integer numbers with real value smaller then 1000. Length of each segment is positive.

When 2 segments don't have a common point then it is said that segments don't collide. In any other case segments collide. Be aware that segments collide even if they have only one point in common.

Segment is said to be isolated if it doesn't collide with all the other segments that are given, i.e. segment i is isolated when for each 1 <= j <= n, (i != j), segments i and j don`t collide. You are asked to find number T - how many segments are isolated.

INPUT:

First line of input contains number N (N <= 50), then tests follow. First line of each test case contains number M (M <= 100) - the number of segments for this test case to be considered. For this particular test case M lines follow each containing a description of one segment. Segment is described by 2 points: start point (Xpi,Ypi) and end point (Xei,Yei). They are given in such order: Xpi Ypi Xei Yei

OUTPUT:

For each test case output one line containing number T.

SAMPLE INPUT:

6
3
0 0 2 0
1 -1 1 1
2 2 3 3
2
0 0 1 1
1 0 0 1
2
0 0 0 1
0 2 0 3
2
0 0 1 0
1 0 2 0
2
0 0 2 2
1 0 1 1
2
1 3 1 5
1 0 1 6

SAMPLE OUTPUT:

1
0
2
0
0
0

Problem setters: Aleksej Viktorchik, Leonid Shishlo.
Huge Easy Contest #1