#include <bits/stdc++.h>
using namespace std;
int main() {
  int T;
  cin >> T;
  for (int z = 0; z < T; z++) {
    int x1, x2, y1, y2, temp;
    cin >> x1 >> y1 >> x2 >> y2;
    if (x1 > x2) {
      temp = x1;
      x1 = x2;
      x2 = temp;
    }
    if (y1 > y2) {
      temp = y1;
      y1 = y2;
      y2 = temp;
    }
    if (x1 == x2 || y1 == y2) {
      temp = (x2 - x1) + (y2 - y1);
    } else {
      temp = (x2 - x1) + (y2 - y1) + 2;
    }
    cout << temp << "\n";
  }
}
