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