LL bought a big cake on his birthday, which was a circle looked from above. HH found it and cut the cake into pieces secretly using a big knife. Each cut was a straight line through the cake. Since HH cut it irregularly, the cake was cut into a mess. Of course finally LL found it and got angry. Before dealing with HH, LL wanted to know how many pieces on earth HH cut the cake into.
The first line of input contains one integer specifying the number of test cases to follow. Each test case begins with a line containing one integer N (1 <= N <= 500), the number of cut HH performed.
Following N lines each contains two numbers describe the ith cut as following:
Suppose the origin is at the center of the cake. Each cut intersects the cake at two points. The polar angles of the two intersections respect to the origin are the given two numbers. They are in the range [-PI, PI).
Note: No three cut intersects at one point. Any two cut are distinct.
For each test case, output a line containing one integer, the number of pieces of the cake.