#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int a, b, c, d, m1 = 0, m2 = 0, m = 0;
    cin >> a >> b >> c >> d;
    cout << max(a + b, c + d) << '\n';
  }
}
