There are twelve wires that run from your cellar to your roof. Unfortunately on their journey they could be randomly mixed up, so you can't tell which cellar wire-end corresponds to which roof wire-end. You have a battery and a light bulb, and you can temporarily twist wires together. You can also travel from the cellar to the roof and back again any number of times. Thus you can construct circuits and test the wires at either end in order to deduce what is going on. But it’s a long way to the roof. So, starting at the bottom, what is the minimum number of journeys you have to make, in order to work out exactly which wire-end in the cellar corresponds with which wire-end on the roof?

This solution takes two trips--from the cellar to the roof and back. And don't forget to bring your label maker.

First in the cellar, bundle (cross) one group of five wires (group A). Next bundle two groups of three (to be named later). Leave the last wire free and label it D.

On to the roof. Use the battery and bulb to identify the group of five and label the wires A1-A5. Find one group of three and label B1-B3. Find the other group of three and label C1-C3. Label the remaining wire D.

Now bundle the wires together as follows:

Bundle 1: A1-B1-D

Bundle 2: A2-B2-C1

Bundle 3: A3-B3

Bundle 4: A4-C2

Go back to the cellar. Find the wire labeled D. One bundled wire will be in group A, label this A1. One of the groups of three will haved the other bundled wire, this will be group B, Label the wire B1. The remaining group will be group C.

Of the two unlabeled wires in group B, one will be part of a bundle of two, the other will be part of a bundle of three. Label the bundle of three B2, A2, and C1 depending on the group that each is in. Label the bundle of two B3 and A3. Now find the last bundle starting with the unlabeled wires in group A. Label these wires A4 and C2. Finally, label the two remaining wires A5 and C3.