#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) << "\n";
}
int main() {
  int t;
  cin >> t;
  while (t--) solve();
}
