#include using namespace std; int64_t f(int64_t n, int64_t y, int64_t x) { int64_t k = min({y, x, n - 1 - y, n - 1 - x}); int64_t sum = 4 * k * (n - k); int64_t rd = 2 * (n - 2 * k - 1); int64_t diff = (2 * (n - 1 - k) - (y + x)) * (y <= x ? -1 : +1); return sum + rd + diff; } int main() { int q; cin >> q; while(q--) { int64_t n, i, j; cin >> n >> i >> j; cout << f(n, i, j) << '\n'; } return 0; }