#codeforcesP2009D. Satyam and Counting

Satyam and Counting

Problem

Satyam is given n distinct points on the 2D coordinate plane. It is guaranteed that 0yi10≤yi≤1 for all given points (xi,yi)(xi,yi). How many different nondegenerate right triangles∗ can be formed from choosing three different points as its vertices?

Two triangles aa and bb are different if there is aa point vv such that vv is a vertex of aa but not a vertex of b.b.


A∗A nondegenerate right triangle has positive area and an interior 9090^\circ angle.

Input

The first line contains an integer t(1t104)t(1≤t≤10^4) — the number of test cases.

The first line of each test case contains an integer n(3n2105)n(3≤n≤2⋅10^5) — the number of points.

The following nn lines contain two integers xix_i and yiy_i (0xin,0yi1)(0≤xi≤n, 0≤yi≤1) — the ii-th point that Satyam can choose from. It is guaranteed that all (xi,yi)(xi,yi) are pairwise distinct.

Output

Output an integer for each test case, the number of distinct nondegenerate right triangles that can be formed from choosing three points.

Example : in

3
5
1 0
1 1
3 0
5 0
2 1
3
0 0
1 0
3 0
9
1 0
2 0
3 0
4 0
5 0
2 1
7 1
8 1
9 1

Example : out

4
0
8

Note

The four triangles in question for the first test case: