using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.IO;
class Myon
{
public Myon() { }
public static int Main()
{
new Myon().calc();
return 0;
}
int T = 10;
void calc()
{
Random r = new Random(2);
List<int> l = new List<int>();
while (true)
{
l.Add(r.Next(0, (1 << 20)));
if (check(l)) break;
}
Console.WriteLine(l.Count);
foreach (var item in l)
{
for (int j = 0; j < 10; j++)
{
Console.Write((((item >> (j * 2)) & 3) + 1) + " ");
}
Console.WriteLine();
}
}
bool check(List<int> l)
{
Dictionary<ulong, bool> dic = new Dictionary<ulong, bool>();
for (int i = 0; i < (1 << 20); i++)
{
ulong p = 0;
foreach (var item in l)
{
int count = 0;
for (int j = 0; j < 10; j++)
{
if (((item >> (j * 2)) & 3) == ((i >> (j * 2)) & 3)) count++;
}
p <<= 4;
p += (ulong)count;
}
if (dic.ContainsKey(p)) return false;
dic[p] = true;
}
return true;
}
}
dXNpbmcgU3lzdGVtOwp1c2luZyBTeXN0ZW0uQ29sbGVjdGlvbnM7CnVzaW5nIFN5c3RlbS5Db2xsZWN0aW9ucy5HZW5lcmljOwp1c2luZyBTeXN0ZW0uTGlucTsKdXNpbmcgU3lzdGVtLklPOwoKY2xhc3MgTXlvbgp7CiAgICBwdWJsaWMgTXlvbigpIHsgfQogICAgcHVibGljIHN0YXRpYyBpbnQgTWFpbigpCiAgICB7CiAgICAgICAgbmV3IE15b24oKS5jYWxjKCk7CiAgICAgICAgcmV0dXJuIDA7CiAgICB9CgogICAgaW50IFQgPSAxMDsKICAgIHZvaWQgY2FsYygpCiAgICB7CiAgICAgICAgUmFuZG9tIHIgPSBuZXcgUmFuZG9tKDIpOwogICAgICAgIExpc3Q8aW50PiBsID0gbmV3IExpc3Q8aW50PigpOwogICAgICAgIHdoaWxlICh0cnVlKQogICAgICAgIHsKICAgICAgICAgICAgbC5BZGQoci5OZXh0KDAsICgxIDw8IDIwKSkpOwogICAgICAgICAgICBpZiAoY2hlY2sobCkpIGJyZWFrOwogICAgICAgIH0KICAgICAgICBDb25zb2xlLldyaXRlTGluZShsLkNvdW50KTsKICAgICAgICBmb3JlYWNoICh2YXIgaXRlbSBpbiBsKQogICAgICAgIHsKICAgICAgICAgICAgZm9yIChpbnQgaiA9IDA7IGogPCAxMDsgaisrKQogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICBDb25zb2xlLldyaXRlKCgoKGl0ZW0gPj4gKGogKiAyKSkgJiAzKSArIDEpICsgIiAiKTsKICAgICAgICAgICAgfQogICAgICAgICAgICBDb25zb2xlLldyaXRlTGluZSgpOwogICAgICAgIH0KICAgIH0KCiAgICBib29sIGNoZWNrKExpc3Q8aW50PiBsKQogICAgewogICAgICAgIERpY3Rpb25hcnk8dWxvbmcsIGJvb2w+IGRpYyA9IG5ldyBEaWN0aW9uYXJ5PHVsb25nLCBib29sPigpOwogICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgKDEgPDwgMjApOyBpKyspCiAgICAgICAgewogICAgICAgICAgICB1bG9uZyBwID0gMDsKICAgICAgICAgICAgZm9yZWFjaCAodmFyIGl0ZW0gaW4gbCkKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgaW50IGNvdW50ID0gMDsKICAgICAgICAgICAgICAgIGZvciAoaW50IGogPSAwOyBqIDwgMTA7IGorKykKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICBpZiAoKChpdGVtID4+IChqICogMikpICYgMykgPT0gKChpID4+IChqICogMikpICYgMykpIGNvdW50Kys7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBwIDw8PSA0OwogICAgICAgICAgICAgICAgcCArPSAodWxvbmcpY291bnQ7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgaWYgKGRpYy5Db250YWluc0tleShwKSkgcmV0dXJuIGZhbHNlOwogICAgICAgICAgICBkaWNbcF0gPSB0cnVlOwogICAgICAgIH0KICAgICAgICByZXR1cm4gdHJ1ZTsKICAgIH0KCn0K