#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
const int maxn = 1e6 + 10;
const int maxm = 4e3 + 10;
const long long inf = 1e18;
int T, n, m;
int main() {
  scanf("%d", &T);
  while (T--) {
    int a, b, c, d;
    scanf("%d %d %d %d", &a, &b, &c, &d);
    printf("%d\n", max(a + b, c + d));
  }
}
