#include <bits/stdc++.h>
using namespace std;
int main() {
  int t, a, b, c, d;
  cin >> t;
  int arr[t];
  for (int i = 0; i < t; i++) {
    cin >> a;
    cin >> b;
    cin >> c;
    cin >> d;
    if ((a + b) >= (c + d)) {
      arr[i] = a + b;
    } else if ((a + b) <= (c + d)) {
      arr[i] = c + d;
    }
  }
  for (int i = 0; i < t; i++) {
    cout << arr[i] << endl;
  }
  return 0;
}
