#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() {
  ios_base::sync_with_stdio(0), cin.tie(NULL);
  int _T = 1;
  cin >> _T;
  while (_T--) solve();
}
