#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    long long a, b, c, d;
    cin >> a >> b >> c >> d;
    long long one = a + b;
    long long two = c + d;
    if (one > two) {
      cout << one << endl;
    } else
      cout << two << endl;
  }
  return 0;
}
