#include using namespace std; typedef long long ll; #define pb push_back #define fi first #define se second typedef pair P; using VP = vector

; using VVP = vector; using VI = vector; using VVI = vector; using VVVI = vector; const int inf=1e9+7; const ll INF=1LL<<61; const ll mod=1e9+7; template inline bool chmax(T &a, T b) { if(a < b) { a = b; return true; } return false; } template inline bool chmin(T &a, T b) { if(a > b) { a = b; return true; } return false; } int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); int i,j; int q; cin>>q; while(q--){ ll n,x,y; cin>>n>>x>>y; swap(x,y); ll m1=min(x,n-x-1); ll m2=min(y,n-x-1); ll m=min(m1,m2); x-=m; y-=m; ll ans=n*n-(n-2*m)*(n-2*m); if(y==0) ans+=x; else if(y==n-1-m-m) ans+=(n-2*m-1)*2+(n-2*m-1-x); else if(x==n-1-m-m) ans+=n-2*m-1+y; else ans+=3*(n-2*m-1)+(n-2*m-1-y); cout<