#include int cas,n,m,t,s; int a[1010][1010]; int main(){ scanf("%d",&cas); while (cas--){ s=0; scanf("%d%d",&n,&m); for (int i=1;i<=n;i++) for (int j=1;j<=m;j++){ scanf("%d",&a[i][j]); if (a[i][j]) s++; } if (((s+m+n+1)%2)==0) printf("YES\n"); else printf("NO\n"); } }