#include <bits/stdc++.h>
using namespace std;
long long a, b, c, d, p, q, ans, t;
void solve() {
  cin >> a >> b >> c >> d;
  p = a + b;
  q = c + d;
  ans = max(p, q);
  cout << ans << endl;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> t;
  while (t--) {
    solve();
  }
}
