#!/usr/bin/env python2
import sys

with open(sys.argv[1]) as f:
    first = True
    for line in f.readlines():
        if first:
            first = False
            continue
        x0,y0, x1,y1, s,f = line.split(' ')

        x0 = int(x0);
        x1 = int(x1);
        y0 = int(y0);
        y1 = int(y1);

        dist = abs(x1-x0) + abs(y1-y0)

        print dist
