#include #include #include #include using namespace std; int m,n,t; int main(int argc, char *argv[]) { int i,j,x,y; scanf("%d",&t); while(t) { scanf("%d%d",&n,&m); int s=0; for(i=0;i