#include #define rep(i,n) for(int i=0;i ; const int INF = 1e9; const int MOD = 1000000007; void solve(){ ll N,I,J; cin >> N >> I >> J; ll k = min({I,J,N-1-J,N-1-I}); ll ans = 2*k*(2*N-k-1); if(k==I){ ans += J-k+1; }else if(k==N-1-J){ ans += N-2*k-1; ans += I-k+1; }else if(k==N-1-I){ ans += 2*(N-2*k-1); ans += N-k-J; } else if(k==J){ ans += 3*N-6*k-3; ans += N-k-I; } cout << ans-1 << endl; return; } int main(){ int q; cin >> q; rep(i,q) solve(); return 0; }