#include <bits/stdc++.h>
using namespace std;
int solve() {
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  return max(a + b, c + d);
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int test = 1;
  cin >> test;
  while (test--) {
    cout << solve();
    cout << '\n';
  }
  return 0;
}
