#include using namespace std; int main() { int t; cin >> t; vector ans(t); for (int i = 0; i < t; i++) { for (int j = 0; j < 5; j++) { vector test(5); cin >> test[j]; sort(test.begin(), test.end()); if (j = 4) { ans[i] = test[j] - test[0]; } } } for (int i = 0; i < t; i++) { cout << ans[i] << endl; } return 0; }