text: /* hyturing - Hemant Kumar Yadav */
  #include "bits/stdc++.h"
  using namespace std; 
  
  #define endl "\n"
  #define ll long long
  const ll  MOD = 1e9+7;
  
  void solve(){
  	int a, b, p, q;
  	cin >> a >> b >> p >> q;
  
  	if(a==p && b==q) cout << 0 << endl;
  	else if((a+b)%2 == (p+q)%2) cout << 2 << endl;
  	else cout << 1 << endl;
  	
  	return;
  }
  
  int32_t main(){
  	ios_base::sync_with_stdio(0);
  	cin.tie(0); cout.tie(0);
  
  	int tc = 1;
  	cin >> tc;
  	for(int i = 1; i <= tc; i++){
  		// cout << "Case #" << i << ": ";
  		solve();
  	}
  
  	return 0;
  }
  