#include <bits/stdc++.h>
using namespace std;
int main() {
  int total{};
  cin >> total;
  for (int t{}; t < total; ++t) {
    int a{}, b{}, c{}, d{};
    cin >> a >> b >> c >> d;
    cout << max(a + b, c + d) << "\n";
  }
  return 0;
}
