#include using namespace std; typedef long long int ll; typedef pair P; typedef vector VI; typedef vector VVI; const ll MOD = 1000000007; const ll INF = 2147483647; const ll LINF = 9223372036854775807; #define REP(i, n) for (int i = 0; i < n; i++) #define ALL(v) v.begin(), v.end() int main() { int q; cin >> q; while(q--){ int n, x, y; cin >> n >> x >> y; int k=min(min(n-x-1,x),min(n-y-1,y)); ll ans=0; REP(i,k) { ans+=4*(n-1); n-=2; } x-=k; y-=k; if(x==0) ans+=y+1; else if(y==n-1) ans+=n+x; else if(x==n-1) ans+=n+n-1+(n-y-1); else ans+=n+n-1+n-1+(n-x-1); cout << ans-1 << endl; } return 0; }