#!/usr/bin/env python3 def solve(n: int, y: int, x: int) -> int: acc = 0 while True: if y == 0: return acc + x acc += n - 1 if x == n - 1: return acc + y acc += n y = n - y - 1 x = (n - 1) - x - 1 n -= 1 def main(): q = int(input()) for i in range(q): n, i, j = map(int, input().split()) t = solve(n, i, j) print(t) if __name__ == '__main__': main()