#include <bits/stdc++.h>
using namespace std;
int main() {
  int t, a, b, c, d, ans;
  cin >> t;
  while (t--) {
    cin >> a >> b >> c >> d;
    ans = max(a + b, c + d);
    cout << ans << endl;
  }
  return 0;
}
