#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e4;
int n, k;
long long int modular_pow(long long int base, int exponent,
                          long long int modulus) {
  long long int result = 1;
  while (exponent > 0) {
    if (exponent & 1) result = (result * base) % modulus;
    exponent = exponent >> 1;
    base = (base * base) % modulus;
  }
  return result;
}
void solve() {
  int64_t a, b, c, d;
  cin >> a >> b >> c >> d;
  int l = 0, r = 0;
  if (a > d) l = a - d;
  if (c > b) r = c - b;
  cout << max(a + b, c + d) << endl;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t;
  cin >> t;
  while (t--) solve();
  return 0;
}
