We have three stones at points (0, 0), (1,0), and (0,1) on a two-dimensional plane.
These three stones are said to form an L when they satisfy the following conditions:
 - Each of the stones is at integer coordinates.
 - Each of the stones is adjacent to another stone. (That is, for each stone, there is another stone whose distance from that stone is 1.)
 - The three stones do not lie on the same line.
Particularly, the initial arrangement of the stone - (0, 0), (1,0), and (0,1) - forms an L.
You can do the following operation any number of times: choose one of the stones and move it to any position. However, after each operation, the stones must form an L.
You want to do as few operations as possible to put stones at points (ax, ay), (bx, by), and (cx, cy). How many operations do you need to do this?
It is guaranteed that the desired arrangement of stones - (ax, ay), (bx, by), and (cx, cy) - forms an L. Under this condition, it is always possible to achieve the objective with a finite number of operations.
You will be given T cases of this problem. Solve each of them.
-----Notes-----
We assume that the three stones are indistinguishable. For example, the stone that is initially at point (0,0) may be at any of the points (ax, ay), (bx, by), and (cx, cy) in the end.
-----Constraints-----
 - 1 \leq T \leq 10^3
 - |ax|,|ay|,|bx|,|by|,|cx|,|cy| \leq 10^9
 - The desired arrangement of stones - (ax, ay), (bx, by), and (cx, cy) - forms an L.
-----Input-----
Input is given from Standard Input in the following format:
T
\text{case}_1
\vdots
\text{case}_T
Each case is in the following format:
ax ay bx by cx cy
-----Output-----
Print T values. The i-th value should be the minimum number of operations for \text{case}_i.
-----Sample Input-----
1
3 2 2 2 2 1
-----Sample Output-----
4
Let us use # to represent a stone.
You can move the stones to the specified positions with four operations, as follows:
....    ....    ....    ..#.    ..##
#... -> ##.. -> .##. -> .##. -> ..#.
##..    .#..    .#..    ....    ....

# URL : https://atcoder.jp/contests/arc109/tasks/arc109_d
T = int(input())
for _ in range(T):
    ax, ay, bx, by, cx, cy = list(map(int, input().split()))
    x = ax + bx + cx
    y = ay + by + cy
    if x == y:
        if x == 1:
            print((0))
        elif x == 2:
            print((1))
        elif x > 0:
            if x % 3 == 2:
                print(((x + 1) // 3 * 2))
            else:
                print(((x - 1) // 3 * 2 + 1))
        else:
            x = -x
            if x % 3 == 2:
                print(((x + 1) // 3 * 2 + 1))
            else:
                print(((x + 2) // 3 * 2))
    else:
        res = 0
        for d in (x, y):
            if d % 3 == 2:
                if d > 0:
                    res = max(res, (d - 2) // 3 * 2 + 1)
                else:
                    res = max(res, (-d - 1) // 3 * 2 + 1)
            else:
                if d > 0:
                    res = max(res, (d - 1) // 3 * 2)
                else:
                    res = max(res, (-d + 1) // 3 * 2)
        print(res)

# URL : https://atcoder.jp/contests/arc109/tasks/arc109_d
T = int(input())
for _ in range(T):
    ax, ay, bx, by, cx, cy = list(map(int, input().split()))
    x = ax + bx + cx
    y = ay + by + cy
    if x == y:
        if x == 1:
            print((0))
        elif x == 2:
            print((1))
        elif x > 0:
            if x % 3 == 2:
                print(((x + 1) // 3 * 2))
            else:
                print(((x - 1) // 3 * 2 + 1))
        else:
            x = -x
            if x % 3 == 2:
                print(((x + 1) // 3 * 2 + 1))
            else:
                print(((x + 2) // 3 * 2))
    else:
        res = 0
        for d in (x, y):
            if d % 3 == 2:
                if d > 0:
                    res = max(res, (d - 2) // 3 * 2 + 1)
                else:
                    res = max(res, (-d - 1) // 3 * 2 + 1)
            else:
                if d > 0:
                    res = max(res, (d - 1) // 3 * 2)
                else:
                    res = max(res, (-d + 1) // 3 * 2)
        print(res)
