...it’s dark in the cube, it’s dark in the cube...
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.
...I was in the cube, I was in the cube...
He remembers a similar situation he found himself in, three years ago, COCI round 2, task Kocka.
...I’m in the cube again, I’m in the cube again...
But this time, things are much more complicated... Daniel is in an n-dimensional hipercube Q_n. 2n−1 identical copies of a tree T with n edges are scattered around him. It soon became clear to him that salvation lies in tiling the edges of the hipercube with the trees.
Formally, a hipercube Q_n is a graph with nodes 0, 1, …, 2n−1, in which nodes x and y are connected if and only if their bitwise xor is a power of two.
A tree can be placed on the hipercube so that:
A tiling of the hipercube is done by placing several trees so that each edge of the hipercube belongs to at most one tree.
Your task is to tile the hipercube Q_n with as many copies of the given tree T, which has n edges.
The first line contains a positive integer n (1≤n≤16), the dimension of the hipercube.
Each of the following n lines contains two integers x and y (0≤x,y≤n, x=y) which denote that the nodes x and y are connected by an edge in tree T.
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 T.
In the i-th line print n+1 numbers a_0(i), a_1(i), … a_n(i). These numbers denote that the i-th tree is placed so that the hipercube node a_j(i) corresponds to the tree node j, for all j=0,…,n.
Clarification of the third example:
