#include #define rep(i,n)for(int i=0;iP; typedef long long ll; const int MOD=1000000007; const int INF=0x3f3f3f3f; const ll INFL=0x3f3f3f3f3f3f3f3f; int main(){ int q;cin>>q; rep(i,q){ ll n,x,y;cin>>n>>x>>y; ll D=min({x,n-x-1,y,n-y-1}); ll ans=n*n-(n-D)*(n-D); if(x==D){ printf("%lld\n",ans+(y-D)+1); continue; } ans+=(n-D)-1; if(y==n-D-1){ printf("%lld\n",ans+(x-D)); continue; } ans+=(n-D)-1; if(x==n-D-1){ printf("%lld\n",ans+(n-D-1)-y); continue; } ans+=(n-D)-1; printf("%lld\n",ans+(n-D-1)-x); } }