#include <bits/stdc++.h>
using namespace std;
const long long inf = 1e18;
long long N = 200005;
long long n;
void solve() {
  long long i, j, k;
  long long a, b, c, d;
  cin >> a >> b >> c >> d;
  cout << max(a + b, c + d) << "\n";
  return;
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  long long t = 1, i, j, k;
  cin >> t;
  while (t--) {
    solve();
  }
  return 0;
}
