#include #include #include using lint = long long; void solve() { lint n, x, y; std::cin >> n >> x >> y; lint d = std::min({x, n - x - 1, y, n - y - 1}); x -= d, y -= d; lint ans = n * n - (n - d * 2) * (n - d * 2); n -= d * 2; if (x == 0) { ans += y; } else if (y == n - 1) { ans += (n - 1) + x; } else if (x == n - 1) { ans += (n - 1) * 2 + (n - 1 - y); } else { ans += (n - 1) * 3 + (n - 1 - x); } std::cout << ans << std::endl; } int main() { std::cin.tie(nullptr); std::ios::sync_with_stdio(false); int q; std::cin >> q; while (q--) solve(); return 0; }