#include <bits/stdc++.h>
using namespace std;
int main() {
  long long t, a, b, c, d, e, f, g, h, i, x, y;
  cin >> t;
  while (t--) {
    cin >> a >> b >> g >> h;
    e = abs((g - 1) + (h - 1));
    f = abs((a - g) + (b - h));
    i = abs((g - 1) + (b - h));
    d = abs((a - g) + (h - 1));
    x = max(e, f);
    y = max(i, d);
    cout << max(x, y) << endl;
  }
}
