#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define SZ(x) (int)(x.size()) #define REP(i, n) for(int i=0;i=0;--i) #define RFOR(i, a, b) for(int i=b-1;i>=a;--i) #define all(x) begin(x),end(x) #define dump(x) cerr<<#x<<" = "<<(x)<; using vvi = vector; using vll = vector; using vvll = vector; using P = pair; const double eps = 1e-8; const ll MOD = 1000000007; const int INF = INT_MAX / 2; const ll LINF = LLONG_MAX / 2; template bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; } template bool chmin(T &a, const T &b) { if (b < a) { a = b; return true; } return false; } template ostream &operator<<(ostream &os, const pair p) { os << p.first << ":" << p.second; return os; } template ostream &operator<<(ostream &os, const vector &v) { os << "["; REP(i, SZ(v)) { if (i) os << ", "; os << v[i]; } return os << "]"; } // edit void solve() { ll N, I, J; cin >> N >> I >> J; ll x = min({I, J, N - I - 1, N - J - 1}); ll ans = N * N - (N - x - x) * (N - x - x); I -= x; J -= x; N -= 2 * x; int i = 0, j = 0; if (I == 0) { ans += J; cout << ans << endl; return; } if (I == N - 1) { ans += 3 * (N - 1); ans -= J; cout << ans << endl; return; } if (J == 0) { ans += 4 * (N - 1); ans -= I; cout << ans << endl; return; } if (J == N - 1) { ans += 1 * (N - 1); ans += I; cout << ans << endl; return; } } int main() { cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(10); // std::ifstream in("input.txt"); // std::cin.rdbuf(in.rdbuf()); int Q; cin >> Q; REP(i, Q)solve(); return 0; }