#include <bits/stdc++.h>
using namespace std;
inline long long read() {
  long long sum = 0, ff = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') {
      ff = -1;
    }
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    sum = sum * 10 + ch - 48;
    ch = getchar();
  }
  return sum * ff;
}
void write(long long x) {
  if (x < 0) {
    putchar('-');
    x = -x;
  }
  if (x > 9) write(x / 10);
  putchar(x % 10 | 48);
}
int t, a, b, c, d;
int main() {
  t = read();
  while (t--) {
    a = read(), b = read(), c = read(), d = read();
    printf("%d\n", max(a + b, c + d));
  }
  return 0;
}
