#include <bits/stdc++.h>
using namespace std;
vector<int> v;
int power(int x, int n) {
  int res = 1;
  while (n) {
    if (n & 1) {
      res = res * x % 1000000007;
    }
    x = x * x % 1000000007;
    n >>= 1;
  }
  return (res % 1000000007);
}
int fac[1005];
int ncr(int n, int r) {
  return fac[n] * (power(fac[n - r], 1000000007 - 2) % 1000000007) % 1000000007;
}
void SieveOfEratosthenes(int n) {
  bool prime[n + 1];
  memset(prime, true, sizeof(prime));
  for (int p = 2; p * p <= n; p++) {
    if (prime[p] == true) {
      for (int i = p * p; i <= n; i += p) prime[i] = false;
    }
  }
  for (int p = 2; p <= n; p++)
    if (prime[p]) v.push_back(p * p);
}
int check_subsequence(string a, string b) {
  int c, d;
  c = d = 0;
  while (a[c] != '\0') {
    while ((a[c] != b[d]) && b[d] != '\0') {
      d++;
    }
    if (b[d] == '\0') break;
    d++;
    c++;
  }
  if (a[c] == '\0')
    return 1;
  else
    return 0;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int T = clock();
  int t;
  cin >> t;
  while (t--) {
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    cout << max(a + b, c + d) << endl;
  }
}
