Q = int(input()) ans = [] for count in range(Q): N, I, J = list(map(int, input().split())) base_I = I if I < N - 1 - I else N - 1 - I base_J = J if J < N - 1 - J else N - 1 - J base = 0 if I - J <= 0: for i in range(base_I if base_I < base_J else base_J): base += (N - ((2 * i) + 1)) * 4 base += I + J - 2 * (base_I if base_I < base_J else base_J) else: for i in range((base_I if base_I < base_J else base_J) + 1): base += (N - ((2 * i) + 1)) * 4 base -= (I + J) - 2 * (base_I if base_I < base_J else base_J) ans.append(base) for i in ans: print(i)