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