#include<bits/stdc++.h>
using namespace std;
mt19937 rd(time(0)+(unsigned long long)(new char));
int Random(int l,int r){
	uniform_int_distribution<int> d(l,r);
	return d(rd);
}
int main(){
	ofstream fout;
	int Tcnt=0;
	while(1){
		++Tcnt;
		fout.open("plant.in");
		int T=5;
		fout<<T<<" 0\n";
		int v=8;
		while(T--){
			int n,m;
			n=Random(1,v);
			m=Random(1,v);
			fout<<n<<' '<<m<<' '<<!!Random(0,5)<<' '<<!!Random(0,5)<<'\n';
			int i,j;
			for(i=1;i<=n;++i){
				for(j=1;j<=m;++j) fout<<!Random(0,3);
				fout<<'\n';
			}
		}
		fout.close();
		system("./plant");
		system("./bl < plant.in > b.out");
		if(system("diff plant.out b.out")) break;
		cout<<"Success on #"<<Tcnt<<'\n';
	}
	return 0;
}
