import java.util.Scanner;
public class Main {//广搜
static int a[][]={{1,1,1,1,1,1,1,1,1},
{1,0,0,1,0,0,1,0,1},
{1,0,0,1,1,0,0,0,1},
{1,0,1,0,1,1,0,1,1},
{1,0,0,0,0,1,0,0,1},
{1,1,0,1,0,1,0,0,1},
{1,1,0,1,0,1,0,0,1},
{1,1,0,1,0,0,0,0,1},
{1,1,1,1,1,1,1,1,1}
};
static int min;
static int x2,y2;
public static void main(String[] args) {
Scanner input=new Scanner(System.in);
int N=input.nextInt();
while(N-->0){
int x1=input.nextInt();
int y1=input.nextInt();
x2=input.nextInt();
y2=input.nextInt();
min=Integer.MAX_VALUE;
int num=0;
SouSuo(x1,y1,num);
System.out.println(min);
}
}
private static void SouSuo(int x1, int y1,int num) {
if(x1==x2&&y1==y2&&num<min){
min=num;
return;
}
if(a[x1][y1+1]==0){
a[x1][y1+1]=1;
SouSuo(x1,y1+1,num+1);
a[x1][y1+1]=0;
}
if(a[x1+1][y1]==0){
a[x1+1][y1]=1;
SouSuo(x1+1,y1,num+1);
a[x1+1][y1]=0;
}
if(a[x1-1][y1]==0){
a[x1-1][y1]=1;
SouSuo(x1-1,y1,num+1);
a[x1-1][y1]=0;
}
if(a[x1][y1-1]==0){
a[x1][y1-1]=1;
SouSuo(x1,y1-1,num+1);
a[x1][y1-1]=0;
}
}
}