#include <bits/stdc++.h>
using namespace std;
const long long INF = 2e9;
const long long MOD = 1e9 + 7;
mt19937_64 azino(777);
void solve() {
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  cout << max(a + b, c + d);
}
signed main() {
  cin.tie(NULL);
  cout.tie(NULL);
  ios_base::sync_with_stdio(NULL);
  int t;
  cin >> t;
  while (t-- > 0) {
    solve();
    cout << '\n';
  }
  return 0;
}
