#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int t, n, m, i, j, x, ans;
  cin >> t;
  while (t--) {
    cin >> n >> m >> i >> j;
    ans = max((n + m), (i + j));
    cout << ans << endl;
  }
  return 0;
}
