Five in the morning. Daniel wakes up, he opens his eyes. His head hurts a bit. He can still hear the ringing in his ears.
He comes to realize that he has found himself at a playground, in a big metal box.
He remembers a similar situation he found himself in, three years ago, COCI round 2, task Kocka.
But this time, things are much more complicated... Daniel is in an
Formally, a hypercube
A tree can be placed on the hypercube so that:
- each node of the tree corresponds to some node of the hypercube
- those nodes have to be distinct
- if there is an edge between two nodes in the tree, then there has to be an edge between the corresponding nodes in the hypercube.
A tiling of the hypercube is done by placing several trees so that each edge of the hypercube belongs to at most one tree.
Your task is to tile the hypercube
Input Specification
The first line contains a positive integer
Each of the following
Output Specification
In the first line print the number of trees in your tiling.
Each of the following lines should describe a placement of a single copy of the tree
In the
Scoring
If your solution correctly places
Of course, if your solution is not correct, you will receive
Your total number of points is equal to the minimum number of points your solution receives over all of the test cases.
It is possible to prove that there always exists a solution which uses all of the
Sample Input 1
1
0 1
Sample Output 1
1
0 1
Sample Input 2
2
0 1
1 2
Sample Output 2
2
0 1 3
0 2 3
Sample Input 3
3
0 1
0 2
0 3
Sample Output 3
4
0 1 2 4
3 1 2 7
5 1 4 7
6 2 4 7
Comments