#include <bits/stdc++.h>
using namespace std;
map<long long int, long long int>::iterator itr;
vector<long long int>::iterator it;
set<long long int>::iterator itt;
const double PI = 3.141592653589793238;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long int t;
  cin >> t;
  while (t--) {
    long long int i, j, k, x, y, z, m, n, a, b, c, d, c1 = 0, c2 = 0, flag = 0,
                                                      sum = 0;
    string s1, str;
    map<long long int, long long int> MAP;
    vector<long long int> v;
    set<long long int> s;
    cin >> a >> b >> c >> d;
    cout << max((a + b), (c + d));
    cout << "\n";
  }
}
