#include #define rep(i,n) for (int i = 0; i < n; ++i) #define ALL(c) (c).begin(), (c).end() #define SUM(x) std::accumulate(ALL(x), 0LL) #define MIN(v) *std::min_element(v.begin(), v.end()) #define MAX(v) *std::max_element(v.begin(), v.end()) #define EXIST(v, x) (std::find(v.begin(), v.end(), x) != v.end()) using namespace std; typedef long long ll; 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; } const int INF = 1e9; const long long INFL = 1LL<<60; ll solve() { ll n, i, j; cin >> n >> i >> j; ll x, y; if (i < n/2 && j < n/2) { x = y = min(i, j); } else if (i < j && i + j <= n-1) { x = y = min(i, j); } else if (i < j && i + j > n-1) { x = y = (n-1) - max(i, j); } else if (i > j && i+j <= n-1) { x = y = min(i, j); } else if (i > j && i+j > n-1) { x = y = (n-1) - max(i, j); } else if (i >= n/2){ x = y = (n-1) - max(i, j); } ll n_xy = 4 * (x * n) - 4 * x * x; ll ans = n_xy; ll h = y, w = x; if (i == y) { ans += j-x; } else if (j == n - x - 1) { ans += n - 2*x - 1; ans += i - y; } else if (i == n - y - 1) { ans += (n-2*x)*2 - 2; ans += (n-x-1) -j; } else { ans += (n-2*x)*3 - 3; ans += (n-y-1) -i; } return ans; } int main() { int q; cin >> q; rep(i, q) { cout << solve() << endl; } return 0; }