#include #include #include #include #include using namespace std; struct node{ int a,b,c,d; }x[1005],y[1005]; struct node2{ int a,b,c,d,sign; }z[1005]; int main(){ int t,i,j,k,p,q,m,n,sum; cin>>t; for(k=1;k<=t;k++){ cin>>m>>n; for(i=0;i