#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 res2 = a + b;
    int res1 = c + d;
    int ans = max(res1, res2);
    cout << ans << '\n';
  }
}
