#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
const long long inff = 0x3f3f3f3f3f3f3f3f;
const int mod = 998244353;
const double eps = 1e-9;
mt19937 rnd(228);
void run() {
  int a, b, c, d;
  scanf("%d%d%d%d", &(a), &(b), &(c), &(d));
  printf("%d\n", max(a + b, c + d));
}
int main() {
  int T;
  scanf("%d", &(T));
  while (T--) run();
  return 0;
}
