#include <bits/stdc++.h>
using namespace std;
int main() {
  long long t;
  cin >> t;
  while (t--) {
    long long a, b, c, d;
    cin >> a >> b >> c >> d;
    if (a + b > c + d)
      cout << a + b << '\n';
    else
      cout << c + d << '\n';
  }
}
