#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    long long int arr[3];
    cin >> arr[0] >> arr[1] >> arr[2];
    sort(arr, arr + 3);
    if (arr[0] + arr[1] + arr[2] - 1 < 4 * 1e9)
      cout << arr[0] + arr[1] + arr[2] - 1 << endl;
    else
      cout << arr[2] - arr[0] - arr[1] + 1 << endl;
  }
}
