Sebastian’s toy-friends

J. F. Sebastian is a genetic designer working for Tyrell Corporation. In
his spare time, he makes small humanoid robots that are his toy-friends.
Sebastian currently has n heads, n bodies and n pairs of legs, and he
wonders how these parts can be distributed to construct n toy-friends.

Heads are codified with uppercase letters (starting at A), bodies with
digits (starting at 0), and legs with lowercase letters (starting at a).
This way, a toy-friend can be codified with three characters, and any
distribution of the 3n pieces can be described with n triples of
characters. For instance, a possible distribution for n = 2 is A1b–B0a:
one robot (A1b) consists of the first head, the second body and the
second pair of legs, while the other robot (B0a) consists of the second
head, the first body and the first pair of legs. The other possible
distributions are A0a–B1b, A0b–B1a and A1a–B0b.

ifnextchar ( ifnextchar (offsettrue(0pt,0pt) offsetfalse ifnextchar
[(0pt,0pt)(0pt,0pt) ifnextchar
[(0pt,0pt)(0pt,0pt)[l](0pt,0pt)(0pt,0pt)[l][] [r][image]

Input

Input consists of several cases, each with a positive integer n. A
special case with n = 0 ends the input.

@par @ @̧tmp=10 @̧tmp=0 @̣tmp@̣tmp by@̣tmp =-@̧tmp=@̣breite @̣leftskip

Output

For every case, print its number starting at one, followed by all the
possible distributions in increasing order. The codifications of the
toy-friends inside each distribution must also appear in increasing
order, separated with dashes.

Problem information

Author: Salvador Roura

Generation: 2026-01-25T11:47:33.798Z

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