A cable with 12 parallel wires was layed between two cities A and B, but they forgot to mark the ends of the wires. Now a worker has to establish the correspondence between wire ends at A and at B. To do the job she applies the following procedure. She can connect somehow the ends in one city, say in A, then go to B and use a simple electrical measuting tool to find out for any pair of ends in B whether the corresponding wires are connected at A or not. What is the minimal number of trips between A and B to complete the job?

Also solve for arrbitrary number of wires in the cable.