#include<iostream>   using namespace std;   int main()   {       int t;       cin>>t;       while(t--)       {         int Xa,Ya,Xb,Yb,Xf,Yf,sum;        cin>>Xa>>Ya>>Xb>>Yb>>Xf>>Yf;        sum=abs(Xa-Xb)+abs(Ya-Yb);        if(Xa==Xb&&Xb==Xf)           {             if(Ya<Yf&&Yb>Yf||Ya>Yf&&Yb<Yf)               sum+=2;           }       if(Ya==Yb&&Yb==Yf)       {           if(Xa<Xf&&Xb>Xf||Xa>Xf&&Xb<Xf)           sum+=2;       }        cout<<sum<<endl;       }     return 0;   }   