#include <iostream>
#include <cstdio>
#include <string.h>
#include <string>
#include <queue>
#include <algorithm>
using namespace std;

const int MaxN = 2000 + 20;
int map[MaxN][MaxN];

void gen(int N){
    cout << N << endl;
    for (int i=1;i<=N;++i)
        for (int j=1;j<=N;++j)
            printf("%d%c",map[i][j]=rand()%100<5?0:1,j==N?'\n':' ');
    int Sx,Sy,Tx,Ty;
    do{
        Sx=rand()%N+1;
        Sy=rand()%N+1;
    }while (!map[Sx][Sy]);
    do{
        Tx=rand()%N+1;
        Ty=rand()%N+1;
    }while (!map[Tx][Ty]);
    printf("%d %d %d %d\n",Sx,Sy,Tx,Ty);
}

int main(){
    int T = 10;
    while (T--) gen(10);
    T = 5;
    while (T--) gen(1000);
    return 0;
}