#include "bits/stdc++.h" using namespace std; #define int long long #define REP(i, n) for (int i = 0; i < (int)n; ++i) #define RREP(i, n) for (int i = (int)n - 1; i >= 0; --i) #define FOR(i, s, n) for (int i = s; i < (int)n; ++i) #define RFOR(i, s, n) for (int i = (int)n - 1; i >= s; --i) #define ALL(a) a.begin(), a.end() #define IN(a, x, b) (a <= x && x < b) templateinline void out(T t){cout << t << "\n";} templateinline void out(T t,Ts... ts){cout << t << " ";out(ts...);} templateinline bool CHMIN(T&a,T b){if(a > b){a = b;return true;}return false;} templateinline bool CHMAX(T&a,T b){if(a < b){a = b;return true;}return false;} constexpr int INF = 1e18; #define endl '\n' #define IOS() ios_base::sync_with_stdio(0);cin.tie(0) void solve(){ int N,X,Y; cin >> N >> X >> Y; int tar = min({X,Y,N - 1 - X,N - 1 - Y}); int ans = N * N - (N - 2 * tar) * (N - 2 * tar); if(X <= Y){ ans += X - tar + Y - tar; }else{ ans += 4 * (N - 1 - tar * 2); ans -= X - tar + Y - tar; } cout << ans << endl; } signed main(){ IOS(); int Q = 1; cin >> Q; while(Q--)solve(); }