The Morning Star
A compass points directly toward the morning star. It can only point in one of eight directions: the four cardinal directions (N, S, E, W) or some combination (NW, NE, SW, SE). Otherwise, it will break.  The directions the compass can point. There are $$$n$$$ distinct points with integer coordinates on a plane. How many ways can you put a compass at one point and the morning star at another so that the compass does not break?
In the first test case, any pair of points won't break the compass:   The compass is at $$$(0,0)$$$, the morning star is at $$$(-1,-1)$$$: the compass will point $$$\text{SW}$$$.  The compass is at $$$(0,0)$$$, the morning star is at $$$(1,1)$$$: the compass will point $$$\text{NE}$$$.  The compass is at $$$(-1,-1)$$$, the morning star is at $$$(0,0)$$$: the compass will point $$$\text{NE}$$$.  The compass is at $$$(-1,-1)$$$, the morning star is at $$$(1,1)$$$: the compass will point $$$\text{NE}$$$.  The compass is at $$$(1,1)$$$, the morning star is at $$$(0,0)$$$: the compass will point $$$\text{SW}$$$.  The compass is at $$$(1,1)$$$, the morning star is at $$$(-1,-1)$$$: the compass will point $$$\text{SW}$$$. In the second test case, only two pairs of points won't break the compass:   The compass is at $$$(6,9)$$$, the morning star is at $$$(10,13)$$$: the compass will point $$$\text{NE}$$$.  The compass is at $$$(10,13)$$$, the morning star is at $$$(6,9)$$$: the compass will point $$$\text{SW}$$$. 
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). The description of the test cases follows.The first line of each test case contains a single integer $$$n$$$ ($$$2 \leq n \leq 2 \cdot 10^5$$$) — the number of points.Then $$$n$$$ lines follow, each line containing two integers $$$x_i$$$, $$$y_i$$$ ($$$-10^9 \leq x_i, y_i \leq 10^9$$$) — the coordinates of each point, all points have distinct coordinates.It is guaranteed that the sum of $$$n$$$ over all test cases doesn't exceed $$$2 \cdot 10^5$$$.
For each test case, output a single integer — the number of pairs of points that don't break the compass.
import sys
input = sys.stdin.readline
for _ in range(int(input())):
    n = int(input())
    ls = [n * [0], n * [0], n * [0], n * [0]]
    for i in range(n):
        x = [int(j) for j in input().rstrip().split()]
        ls[0][i] = x[0]
        ls[1][i] = x[1]
        ls[2][i] = x[0] - x[1]
        ls[3][i] = x[0] + x[1]
    s = 0
    for i in range(4):
        ls[i].sort()
        p = 0
        cnt = 0
        for j in ls[i]:
            if j == p:
                s += cnt
                cnt += 1
            else:
                cnt = 1
            p = j
    s *= 2
    print(s)
import sys
input = sys.stdin.readline
for _ in range(int(input())):
    n = int(input())
    ls = [n * [0], n * [0], n * [0], n * [0]]
    for i in range(n):
        x = [int(j) for j in input().rstrip().split()]
        ls[0][i] = x[0]
        ls[1][i] = x[1]
        ls[2][i] = x[0] - x[1]
        ls[3][i] = x[0] + x[1]
    s = 0
    for i in range(4):
        ls[i].sort()
        p = 0
        cnt = 0
        for j in ls[i]:
            if j == p:
                s += cnt
                cnt += 1
            else:
                cnt = 1
            p = j
    s *= 2
    print(s)
import sys
input = sys.stdin.readline
for _ in range(int(input())):
    n = int(input())
    ls = [n * [0], n * [0], n * [0], n * [0]]
    for i in range(n):
        (a, b) = map(int, input().split())
        ls[0][i] = a
        ls[1][i] = b
        ls[2][i] = a - b
        ls[3][i] = a + b
    s = 0
    for i in range(4):
        ls[i].sort()
        p = 0
        cnt = 0
        for j in ls[i]:
            if j == p:
                s += cnt
                cnt += 1
            else:
                cnt = 1
            p = j
    s *= 2
    print(s)