#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  while (n--) {
    unsigned long long a, b, c;
    cin >> a >> b >> c;
    unsigned long long d;
    d = (a * a + (b + c) * (b + c));
    d = sqrt(d) - 1;
    cout << d << "\n";
  }
  return 0;
}
