def main(): Q=int(input()) for _ in range(Q): n,i,j=map(int,input().split()) cl=min(min(i,n-1-i),min(j,n-1-j)) ans=-1 if cl: for w in range(cl): ans+=4*(n-1-2*w) if i<=j: ans+=i+j-2*cl+1 else: ans+=(n-1-2*cl)*4+2-(i+j-2*cl+1) print(ans) if __name__ == '__main__': main()