#include using namespace std; typedef long long ll; typedef long double ld; typedef pair P; typedef pair Pi; #define rep(i,n) for(ll i=0;i inline bool chmax(T &a, T b){if(a inline bool chmin(T &a, T b){if(a>b){a=b;return true;}return false;} template ostream& operator<<(ostream& s,const complex& d) {return s<<"("< ostream& operator<<(ostream& s,const pair& d) {return s<<"("< ostream& operator<<(ostream& s, const vector& d){int len=d.size();rep(i,len){s< ostream& operator<<(ostream& s,const vector>& d){int len=d.size();rep(i,len){s< ostream& operator<<(ostream& s,const set& v){s<<"{ ";for(auto itr=v.begin();itr!=v.end();++itr) {if (itr!=v.begin()) {s<< ", ";}s<<(*itr);}s<<" }";return s;} template ostream& operator<<(ostream& s,const map& m){s<<"{"<>q; while(q--){ ll n,h,w; cin>>n>>h>>w; ll d=inf; chmin(d,h); chmin(d,n-1-h); chmin(d,w); chmin(d,n-1-w); ll ans=4*d*(n-d); ans--; if(h==d) ans+=w-d+1; else{ ans+=n-1-d-d+1; if(w==n-1-d) ans+=h-d; else{ ans+=n-2*d-1; if(h==n-1-d){ ans+=n-1-d-w; }else{ ans+=n-1-d-d; cout<