#include <bits/stdc++.h>
const long long N = 1e6 + 10;
const long long INF = 1e18;
const long long inf = -1e18;
const long long MOD = 1e7 + 7;
using namespace std;
long long binpow(int a, int n) {
  if (n == 0) return 1;
  if (n % 2 == 1)
    return binpow(a, n - 1) * a;
  else {
    long long b = binpow(a, n / 2);
    return b * b;
  }
}
long long a, b, c, d;
void solve() {
  cin >> a >> b >> c >> d;
  cout << max(a + b, c + d) << "\n";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long o = 1;
  cin >> o;
  while (o--) {
    solve();
  }
}
