#include<bits/stdc++.h>
using namespace std;
int main(){
    freopen("plant.in","w",stdout);
    ios::sync_with_stdio(false);
    mt19937 s(chrono::steady_clock::now().time_since_epoch().count());
    int T=s()%5+1;
    cout<<T<<' '<<s()%20+1<<'\n';
    while (T--){
        int n=s()%20+1,m=s()%20+1,c=s()%2,f=s()%2;
        cout<<n<<' '<<m<<' '<<c<<' '<<f<<'\n';
        for (int i=1;i<=n;i++){
            for (int j=1;j<=m;j++)
                cout<<s()%2;
            cout<<'\n';
        }
    }
    return 0;
}