Roses and pots (1)

You have roses of three different colors. In particular, you have nn roses of each color. Please print all the ways to plant all the roses in a line of 3n3n pots, one rose per pot, in such a way that there is exactly one pair of adjacent roses of the same color. The roses of the same color are indistinguishable.

Input

Input consists of several cases, each with nn. Assume 1n61 \le n \le 6.

Output

For every case, print all the solutions in lexicographical order. Use numbers starting at one to identify each color. Print a line with 10 asterisks after every case.

Problem information

Author: Salvador Roura

Generation: 2026-01-25T12:15:30.378Z

© Jutge.org, 2006–2026.
https://jutge.org