#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t;
  cin >> t;
  while (t--) {
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    int s1 = a + b;
    int s2 = c + d;
    int s3 = a + c;
    int s4 = d + b;
    int ans = max(s1, s2);
    cout << ans << endl;
  }
  return 0;
}
