#include <bits/stdc++.h>
using namespace std;
int main() {
  long int n, count = 0;
  cin >> n;
  while (n--) {
    long long int a, b, c;
    cin >> a >> b >> c;
    long long int maxi = max(a, max(b, c));
    long long int mini = min(a, min(b, c));
    maxi = maxi - mini;
    maxi = maxi * maxi;
    mini = mini * mini;
    cout << (long long int)(sqrt(maxi + mini)) << endl;
    ;
  }
  return 0;
}
