#include <bits/stdc++.h>
using namespace std;
long long mod;
long long gcd(long long a, long long b) {
  return a % b == 0 ? b : gcd(b, a % b);
}
long long pow(long long a, long long b) {
  long long an = 1;
  long long base = a % mod;
  while (b > 0) {
    if (b & 1 != 0) {
      an = (an * base) % mod;
    }
    base = (base * base) % mod;
    b >>= 1;
  }
  return an % mod;
}
long long inv(long long a) { return pow(a, mod - 2); }
long long lcm(long long a, long long b) { return a * b / gcd(a, b); }
long long Arithmetic(long long a1, long long n, long long d) {
  long long sum = 0;
  sum += n * a1;
  sum %= mod;
  long long temp = n * (n - 1);
  temp %= mod;
  temp *= d;
  temp %= mod;
  temp /= 2;
  temp %= mod;
  return (sum + temp) % mod;
}
long long euler(long long n) {
  long long ans = n;
  for (long long i = 2; i * i <= n; i++)
    if (n % i == 0) {
      ans = ans - ans / i;
      while (n % i == 0) n /= i;
    }
  if (n > 1) ans = ans - ans / n;
  return ans;
}
void release_que(queue<long long> q) {
  while (!q.empty()) {
    q.pop();
  }
  return;
}
double fabs(double a) {
  if (a >= 0) {
    return a;
  }
  return -a;
}
double Newtonsqrt(double n, double errors) {
  if (n < 0) {
    return -1;
  }
  double root = n;
  while (fabs(n - root * root) >= errors) {
    root = (n / root + root) / 2.0;
  }
  return root;
}
int main(void) {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long t;
  cin >> t;
  while (t--) {
    long long a, b, c, d;
    cin >> a >> b >> c >> d;
    cout << max(a + b, c + d) << endl;
  }
  return 0;
}
