Problem A
Åboulevarden

Your study group is planning a pub crawl in the bars along one side of the Aarhus River.
All the bars are nice and inviting, but each serves only one kind of beer. The members of your group have different, varying, and even conflicting preferences in beverages, so you switch bars often.
You have a map of the
When the system is finished, it should take as input your group’s current location (i.e., the current bar) and the name of a beer, and return directions to a nearest bar serving that beer. This way, you will have a foolproof way to continue the crawl even when your natural navigation skills inevitably fall short.
Input
The first line contains an integer
The next line contains an integer
You can assume that the input file is no larger than 10 MiB.
Output
For each navigation query
There should be a bar at location
Sample Input 1 | Sample Output 1 |
---|---|
5 Limfjordsporter Hof X-mas Hof 1664 3 1 Limfjordsporter 0 Hof 1 1664 |
-1 1 3 |
Sample Input 2 | Sample Output 2 |
---|---|
3 Top Gulddame Limfjordsporter 3 1 Gulddame 0 Gulddame 2 Gulddame |
0 1 -1 |
Sample Input 3 | Sample Output 3 |
---|---|
7 Juleren Giraf Elephant NightingAle Juleren Elephant Giraf 4 0 Elephant 3 Juleren 4 Giraf 6 NightingAle |
2 1 2 -3 |