# coding: utf-8 # Your code here! import sys readline = sys.stdin.readline read = sys.stdin.read q,*nab = [int(i) for i in read().split()] M = iter(nab) for n,a,b in zip(M,M,M): d = min(a,b,n-a-1,n-b-1) ans = n*n-(n-2*d)*(n-2*d) n -= 2*d a -= d b -= d if a==0: ans += b elif b==n-1: ans += n-1+a elif a==n-1: ans += 3*(n-1)-b else: ans += 4*(n-1)-a print(ans)