#include <bits/stdc++.h>
using namespace std;
int inf = 1e9;
long long mod = 1e9 + 7;
int a, b, c, d;
int gcd(int a, int b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
int lcm(int a, int b) { return a * b / gcd(a, b); }
void solve() {
  cin >> a >> b >> c >> d;
  cout << max(a + b, c + d) << endl;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t;
  cin >> t;
  while (t--) {
    solve();
  }
  return 0;
}
