#include <bits/stdc++.h>
using namespace std;
class TC {
 public:
  void solve() {
    long long int n, m, l, p, i, cnt = 0;
    cin >> n >> m >> l >> p;
    cout << max((n + m), (l + p)) << endl;
  }
};
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int t, i;
  cin >> t;
  for (i = 1; i <= t; i++) {
    TC tc;
    tc.solve();
  }
  return 0;
}
