#include <bits/stdc++.h>
using namespace std;
const long long cf = 1e5 + 1;
const long double pi = acos(-1);
const long long mod = 1e9 + 7;
long double dis(long double a1, long double b1, long double a2,
                long double b2) {
  return sqrt(((a1 - a2) * (a1 - a2)) + ((b1 - b2) * (b1 - b2)));
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long t;
  cin >> t;
  while (t--) {
    long long a, b, c, d;
    cin >> a >> b >> c >> d;
    cout << max(a + b, c + d) << endl;
  }
  cerr << "Time execute: " << clock() / (double)CLOCKS_PER_SEC << " sec"
       << endl;
  return 0;
}
