#include <bits/stdc++.h>
#define ll long long int
#define unll unsigned long long
#define pb push_back
#define mp make_pair
#define aff(v) for(auto e:v) cout<<e<<" ";cout<<endl;
#define f(i,j,k,l) for(ll i=j;i<k;i+=l)
typedef unsigned long long ull;
typedef long double db;
using namespace std;
const ll n=2e5+5;
string inverserChaine(const std::string& chaine) {
string chaineInverse;
for (int i = chaine.length() - 1; i >= 0; i--) {
chaineInverse += chaine[i];
}
return chaineInverse;
}
void solve() {
int y;cin>>y;
while(y--){
int a,b ;cin>>a;cin>>b;
int xk,yk;cin>>xk;cin>>yk;
int xq,yq;cin>>xq;cin>>yq;
int xn,yn,xn1,yn1,xnn,ynn,xn11,yn11,xa,xaa,ya,yaa,xa1,xaa1,ya1,yaa1;
set<pair<int, int>> m;
//if(a>abs(xq-xk) && b>abs(yq-yk))cout<<"0"<<endl;
if((xk==xq && abs(yk-yq)%2==0 && (a==abs(yk-yq)/2 ||b==abs(yk-yq)/2))||((yk==yq && abs(xk-xq)%2==0) &&(a==abs(xk-xq)/2 ||b==abs(xk-xq)/2))){
cout<<"2"<<endl;
}
else {
set<pair<int, int>> s;
// Calculate eight new positions and insert them into the set
s.insert({xk + a, yk + b});
s.insert({xk + a, yk - b});
s.insert({xk + b, yk + a});
s.insert({xk + b, yk - a});
s.insert({xk - a, yk + b});
s.insert({xk - a, yk - b});
s.insert({xk - b, yk + a});
s.insert({xk - b, yk - a});
s.insert({xq + a, yq + b});
s.insert({xq + a, yq - b});
s.insert({xq + b, yq + a});
s.insert({xq + b, yq - a});
s.insert({xq - a, yq + b});
s.insert({xq - a, yq - b});
s.insert({xq - b, yq + a});
s.insert({xq - b, yq - a});
if(a==b){cout<<8-s.size()<<endl;}
else cout<<16-s.size()<<endl;
}
}}
int main(){
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
ios_base::sync_with_stdio(false);
cin.tie(0);
solve ();
}
1487A - Arena | 1520D - Same Differences |
376A - Lever | 1305A - Kuroni and the Gifts |
1609A - Divide and Multiply | 149B - Martian Clock |
205A - Little Elephant and Rozdil | 1609B - William the Vigilant |
978B - File Name | 1426B - Symmetric Matrix |
732B - Cormen --- The Best Friend Of a Man | 1369A - FashionabLee |
1474B - Different Divisors | 1632B - Roof Construction |
388A - Fox and Box Accumulation | 451A - Game With Sticks |
768A - Oath of the Night's Watch | 156C - Cipher |
545D - Queue | 459B - Pashmak and Flowers |
1538A - Stone Game | 1454C - Sequence Transformation |
165B - Burning Midnight Oil | 17A - Noldbach problem |
1350A - Orac and Factors | 1373A - Donut Shops |
26A - Almost Prime | 1656E - Equal Tree Sums |
1656B - Subtract Operation | 1656A - Good Pairs |