#include<bits/stdc++.h>
#define ints long long int
#define ll  long long
#define ull unsigned long long
#define rep(a,b,i) for(int i=a;i<b;i++)
#define pb push_back
#define mx LONG_MAX
#define my LONG_MIN
#define modp(a,b) (a%mod+b%mod)%mod
#define mods(a,b) (a%mod-b%mod)%mod
#define modd(a,b) (a%mod/b%mod)%mod
#define modm(a,b) ((a%mod)*(b%mod))%mod

using namespace std;
long long mod=1e9+7;
void solve();
int main()
{

	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	ll t;
	cin>>t;
	while(t--)
	{ 
		
		
		solve();

		cout<<endl;
		
	}
}

void solve() 
{
	ll x1,x2,y1,y2,f1,f2;

	cin>>x1>>x2>>y1>>y2>>f1>>f2;
	ll sum=0;
	
	if(x1==f1&&y1==f1||x2==f2&&y2==f2)
	{
		if(x2>f2&&y2<f2)
		{
			x1+=1;
			y1+=1;
			sum+=2;
		}
		else if(x2<f2&&y2>f2)
		{
			x1+=1;
		y1+=1;
		sum+=2;
		}
		else if(x2==f2&&y2==f2)
		{
			if(x1<f1&&y1>f1)
			{
				x2+=1;
				y2+=1;
				sum+=2;
			}
			else if(x1>f1&&y1<f1)
			{
				x2+=1;
				y2+=1;
				sum+=2;
			}
		}



	}
	ll ans=abs(x1-y1);
	ll ans1=abs(x2-y2);

	sum+=ans+ans1;
	cout<<sum;

}

