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