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