What was the task to test the skill?
The shortest distance is 20 km! Surprised? Read further.
Let's name the two exchanges as a 1 & 2 respectively. Now at end 1, let's make a groups of wires having 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 number of wires. Now somebody might ask why not 15 groups having 8 wires in each. After reading the entire process here, we'll get the answer of it.So we 15 groups have total 1 + 2 + 3....+ 15 = 120 wires. Let's name these groups as A, B, C, D ...... O. That means group A has 1, B has 2, C has 3 wires & so on.
Now join together all the wires of the particular group. For example, 2 wires of group B should be joined together, 7 wires of G tied together & so on. The sole wire of A is left as it is.
We will take the battery & bulb to other end traveling 10 km. We will say a wire is paired with the other if the bulb gets illuminated if battery & bulb connected in between.
Now let's take any wire at the other end & find the number of wires that are pairing with that particular wire under test. We will group such wires & label with those exactly how we labeled at end 1.
For example, if we find 2 wires pairing with particular wire then that wire & 2 paired wires together to be grouped in 3 wires & labeled as C.The sole wire not getting paired with any will be labeled as A. And group with wire pairing with 7 other wires together should be labeled as H.
In this way, we will have the exact group structure that we have at end 1. By now, we have identified & labeled correctly wires in groups of 1,2,3,....15 wires at both ends.
Now, we are going to label each wire of group by it's group & count number. For example, the only wire in group A labeled as A1, 2 wires in B are labeled as B1,B2, wires in G are labeled as G1,G2,G3,G4,G5,G6,G7 and so on.
Now, at end 2 itself, what we are going to do is connecting first wire of each group to A1. Second wire of each group to be connected to B2, third of each to be connected to C3 and so on. (refer the diagram above, where labels of wires that are to be connected together are written in same color).
It's time to travel 10 km back to end 1. Here, we have 15 groups of wires having 1,2,3...15 wires & labeled as A, B, C,...O respectively.
Taking out only wire of group A which must be A1, the battery & bulb tested in between A1 & 2 wires of group B. The wire which forms pair (recall that we are saying wire is paired with the other if the bulb gets illuminated if battery & bulb connected in between) must be B1 as A1 & B1 shorted at the other end.
Similarly, 3 wires of group C to be 'tested' against A1 to identify C1 & 4 wires of D 'tested' to know D1. In this way, the first wire of each group can be identified & labeled accordingly using A1.
Now, group B would have only 1 wire to be identified & that must be B2 as B has only 2 wires. Again, 'testing' 2 wires of C (C1 is already labeled) against B2 would help us to identify C2. Same way, second wire of each group can be identified & labeled using B2.
In this way, we can identify & label each wire of each group. The wire which is not connected to any at other end is O15 & hence at end 1 there would be 1 wire not pairing with any which must be that O15.
Did you counted how many times we traveled from end 1 to end 2 or end 2 to end 1? Right, only 2 times. Once to reproduce the group structure (made at end 1) at end 2, we traveled from end 1 to end 2. At end 2, we labeled individual wires, connected those in certain pattern. And then came back to end 1 to identify & label each wire of each group.
Back to the question raised at the start; why not 15 groups with 8 wires in each. In that case, we can only make 15 groups with 8 wires each at the end 2 but not able to identify those. Reason is we are not sure which group of wires are from particular group say group A created at the end 1. By differentiating groups by number of wires, we'll be able to reproduce exact group structure at end 2 as created at end 1
To conclude, we need to travel only 20 km to correctly identify 2 ends of each of 120 wires. Aren't you agree with this?