#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, a, b, c, d, x[3025];
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a >> b >> c >> d;
    if ((a + b) >= (c + d)) {
      x[i] = a + b;
    } else if ((a + b) < (c + d)) {
      x[i] = c + d;
    }
  }
  for (int i = 0; i < n; i++) {
    cout << x[i] << "\n";
  }
}
