mod = 998244353 def main(): import sys input = sys.stdin.readline for _ in range(int(input())): a, b, c, d = map(int, input().split()) if a > c and b > d: print(c + d + 2) elif a < c and b < d: if (a - b) * (c - d) > 0: print(c - a + d - b) else: if a < b: print(c - a + d + 1) else: print(d - b + c + 1) else: if (a - b) * (c - d) > 0: if a < b: if d >= b: print(1 + d - b + c) else: if a == 1: print(3 + c + d) else: print(2 + c + d) else: if c >= a: print(1 + c - a + d) else: if b == 1: print(3 + c + d) else: print(2 + c + d) else: if a > b: if d >= b: print(1 + d - b + c) else: print(2 + c + d) else: if c >= a: print(1 + c - a + d) else: print(2 + c + d) if __name__ == '__main__': main()