#include <bits/stdc++.h>
using namespace std;
void solve() {
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  cout << max(a + b, c + d) << endl;
}
int main() {
  int test;
  cin >> test;
  while (test--) {
    solve();
  }
  return 0;
}
