#include <bits/stdc++.h>
using namespace std;
class cmp {
  int param;

 public:
  cmp(int p) : param(p) {}
  bool operator()(int i) {}
};
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int t;
  cin >> t;
  while (t--) {
    long long int a, b, c, d;
    cin >> a >> b >> c >> d;
    cout << max(a + b, c + d) << '\n';
  }
  return 0;
}
