#include <iostream>
#include <string.h>
using namespace std;
const int N = 10000;
struct Save{
int output[ 5 ];
}save[10005];
void CopyRandom( int dst, int src ){
int copyArr[] = { 0 , 1, 2, 3, 4 };
random_shuffle( copyArr, copyArr + 5 );
for ( int i = 0 ; i < 5 ; i++ )
save[dst].output[i] = save[src].output[ copyArr[i] ];
}
int main(){
for ( int i = 1 ; i <= 10 ; i++ ){
cout << N << endl;
for ( int j = 0 ; j < 5 ; j++ )
save[1].output[j] = rand() % 400 + 100;
for ( int j = 2 ; j <= N ; j++ ){
int t = rand() % 3;
if ( t == 0 ){
int k = rand() % (j-1) + 1;
CopyRandom( j , k );
}
else{
for ( int i = 0 ; i < 5 ; i++ )
save[j].output[i] = rand() % 400 + 100;
}
}
for ( int j = 1 ; j <= N ; j++ ){
for ( int k = 0 ; k < 5 ; k++ )
cout << save[j].output[k] << " ";
cout << endl;
}
}
cout << 0 << endl;
return 0;
}