ll q,n,i,j,k;{rd(q);rep(q)rd(n,i,j++),k=2min({i,j,n-i,n-j}),wt(k*(2n-k)-1+(i