#include <bits/stdc++.h>
const int factor_N = 10000005;
const int tree_arr_N = 1000005;
using namespace std;
int read() {
  char c = getchar();
  int x = 0, f = 1;
  for (; !isdigit(c); c = getchar())
    if (c == '-') f = -1;
  for (; isdigit(c); c = getchar()) x = x * 10 + c - 48;
  return x * f;
}
int t, a, b, c, d;
int main() {
  t = read();
  while (t--) {
    a = read();
    b = read();
    c = read();
    d = read();
    if (a + b >= c + d)
      cout << a + b << endl;
    else
      cout << c + d << endl;
  }
  return 0;
}
