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