Devu loves to play with his dear mouse Jerry.  One day they play a game on 2 dimensional grid of dimensions n * n (n ≥ 2). Jerry is currently at coordinates (sx, sy) and wants to move to location (ex, ey) where cheese is placed by Devu. Also Devu is very cunning and has placed a bomb at location (bx, by). All these three locations are distinct. 

In a single move, Jerry can go either up, down, left or right in the grid such that it never goes out of the grid. Also, it has to avoid the bomb. Find out minimum number of moves Jerry needs. It is guaranteed that it is always possible to do so.

-----Input-----
- The first line of the input contains an integer T denoting the number of test cases. The description of T test cases follows."
- The first line of each test case contains seven space separated integers n, sx, sy , ex, ey, bx, by. 

-----Output-----
- For each test case, output a single line containing an integer corresponding to minimum number of moves Jerry needs.

-----Constraints-----
- 1 ≤ T ≤ 1000
- 2 ≤ n ≤ 20
-  1 ≤ sx, sy , ex, ey, bx, by ≤ n 
- No two or more poitns in the three points are same.

-----Example-----
Input:
2
2 1 1 2 2 1 2
3 1 1 1 3 1 2

Output:
2
4

-----Explanation-----
Example case 1. ...
Jerry will move directly (1, 1) to (2, 1) and then to (2, 2) in total 2 moves.

Example case 2. ...

```python

USER_FILENAME = "<user_code>"
import sys, json, builtins
import math, heapq, bisect, itertools, functools, collections, statistics, fractions, decimal, operator, array, random, re, string, os, pathlib
try:
    import resource as _res
except Exception:
    _res = None
from collections import Counter, defaultdict, deque, OrderedDict
from functools import lru_cache, reduce
from itertools import accumulate, permutations, combinations, product
from math import gcd, ceil, floor, sqrt
from decimal import Decimal
try:
    from typing import *
except Exception:
    pass
try:
    sys.setrecursionlimit(1_000_000)
except Exception:
    pass
try:
    import site as _site
    try:
        _sys_sites = _site.getsitepackages() if hasattr(_site, "getsitepackages") else []
        for _p in _sys_sites:
            if _p and _p not in sys.path:
                sys.path.append(_p)
    except Exception:
        pass
    try:
        _usp = _site.getusersitepackages()
        if isinstance(_usp, str):
            _usp = [_usp]
        for _p in _usp:
            if _p and _p not in sys.path:
                sys.path.append(_p)
    except Exception:
        pass
except Exception:
    pass

ns = {"__name__": "__main__"}
for _k, _v in list(globals().items()):
    if not _k.startswith("_"):
        ns[_k] = _v
_CODE = "import sys\n\ndef _r(*conv) :\n r = [conv[i](x) for i, x in enumerate(input().strip().split(' '))]\n return r[0] if len(r) == 1 else r\n\ndef _ra(conv) :\n return list(map(conv, input().strip().split(' ')))\n\ndef _rl() :\n return list(input().strip())\n\ndef _rs() :\n return input().strip()\n\ndef _a(k, *v) :\n return all(x == k for x in v)\n\ndef _i(conv) :\n for line in sys.stdin :\n  yield conv(line)\n##################################################################\n\n\nfor _ in range(_r(int)) :\n n, sx, sy, ex, ey, bx, by = _ra(int)\n\n if sx != ex and sy != ey : \n  print(abs(sx - ex) + abs(sy - ey))\n else : \n  if sx == ex : \n   if sx == bx : \n    if (by > sy and by < ey) or (by < sy and by > ey) :\n     print(abs(sx - ex) + abs(sy - ey) + 2)\n    else :\n     print(abs(sx - ex) + abs(sy - ey))\n   else : \n    print(abs(sx - ex) + abs(sy - ey))\n  else :\n   if sy == by : \n    if (bx > sx and bx < ex) or (bx < sx and bx > ex) :\n     print(abs(sx - ex) + abs(sy - ey) + 2)\n    else : \n     print(abs(sx - ex) + abs(sy - ey))\n   else : \n    print(abs(sx - ex) + abs(sy - ey))\n\n\n"
_co = compile(_CODE, USER_FILENAME, "exec")
exec(_co, ns, ns)

```

Measured memory_bytes: 15105