In Wonderland there are at least 5 towns. Some towns are connected directly by roads or railways. Every town is connected to at least one other town and for any four towns there exists some direct connection between at least three pairs of towns among those four. When entering the public transportation network of this land, the traveller must insert one gold coin into a machine, which lets him use a direct connection to go to the next town. But if the traveller continues travelling from some town with the same method of transportation that took him there, and he has paid a gold coin to get to this town, then going to the next town does not cost anything, but instead the traveller gains the coin he last used back. In other cases he must pay just like when starting travelling. Prove that it is possible to get from any town to any other town by using at most 2 gold coins.
Solutions — 2
Solution 1
Let and be any two towns. We know that it must be possible to move from to some other town and from to some other town . From four towns we can form three pairs which all have a direct connection between them. Of those at least one way goes from either or to either or . Therefore it is possible to travel from to .
Look at some possible way of getting from to ; let be the first town after town on this way and be the last town before town (see fig. 36). Assume that are all distinct, because otherwise the problem statement follows trivially. Because of the same reason assume that there does not exist a direct connection between and and or and . As according to the problem statement we can get three pairs from those four that all have direct connection between them, a direct connection must be between and .

Figure 36

Figure 37

Figure 38

Figure 39
Let be some town that is not or . If there is a direct connection between and and also between and , then the problem statement holds. Therefore let us assume in the following that there is no direct connection between either and or and . From and we can form three pairs that have a direct connection between them. As there is a maximum of one direct connection between and and there is no direct connection between and , then there must be one between and . By switching the roles of and and also and we get analogously that there is a direct connection between and (see fig. 37).
If the connections between and , and and , are of different kind, then on the path there must be at least two consecutive steps with same mode of transportation. For this path the problem statement holds. But if connections between and , and and , are of the same kind, then there must exist two consecutive steps with the same mode of transportation on the path . For this the problem statement also holds.
Solution 2
Let and be any two towns. Suppose that there is no direct connection between them, because otherwise the problem statement holds trivially.
Let be any town distinct from and . If there is no direct connection between and and no direct connection between and , then from a fourth town there must be a direct connection to , and (see fig. 38). In that case one can go from to via and the problem statement holds. Because of that suppose in the following that from any town distinct from and there is a direct connection to either or .
Let and be any two distinct towns that are not or . Suppose that there is no direct connection between and . As there is also no direct connection between and , but from , , and we can form three pairs that have a direct connection between them, it is possible to go from to via or , in which case the problem statement holds. Now the only case to look at is the one where between any two towns that are not and there is a direct connection.
As there are at least 5 towns in the country, there are at least 3 towns other than and . Therefore either or must have a direct connection to at least two other towns. Without loss of generality assume that has a direct connection to and . But also has a direct connection to some town ; if coincides with any of the previously mentioned ones then the problem statement holds, which leaves us to look at the case where is a new town. Previously mentioned facts give us that , and all have direct connections between them.
If now either and or and have a direct connection between them of different kind than what is between and , then either path or has two consecutive steps with same mode of transportation. For this path the problem statement holds. But if the connection between and or and is of the same kind as the connection between and , then either on the path or there are two consecutive steps with same mode of transportation. For this also the problem statement holds.