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