#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
const int mxN = 1e5;
void solve() {
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  cout << max(a + b, c + d) << "\n";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int tt;
  cin >> tt;
  while (tt--) solve();
}
