#include<bits/stdc++.h>
using namespace std;
int T,id;
#define rt register int 
int n,m,C,F;
const int mod=998244353;
char g[1005][1005];
string s;
int main()
{
	freopen("plant.in","r",stdin);
	freopen("plant.out","w",stdout);
	scanf("%d%d",&T,&id);
	while(T--){
		scanf("%d%d%d%d",&n,&m,&C,&F);
		for(rt i=1;i<=n;++i)
			scanf("%s",g[i]+1);
//		for(rt i=1;i<=n;++i){
//			for(rt j=1;j<=m;++j)
//				printf("%c",g[i][j]);
//			printf("\n");
//		}
		printf("0\n");
	}
	return 0;
}