#include<bits/stdc++.h>
using namespace std;
int main(){
	freopen("plant.in","w",stdout);
	srand(time(NULL));
	int T=rand()%5+1;
	cout<<T<<" "<<1<<endl;
	while(T--){
	    int n=rand()%500+500;
	    int m=rand()%500+500;
	    printf("%d %d 1 1\n",n,m);
	    for(int i=1;i<=n;i++){
	        for(int j=1;j<=m;j++){
	        	if(j%2==0)cout<<1;
	        	else cout<<rand()%2;
			}
			cout<<endl;
		}
    }  
}
