Your employer, the California Car Club (CCC), has decided to offer a trip-routing service to its members. Write a program that reads a list of (departure point, destination point) pairs and computes the shortest route between the two cities of each pair. For every trip, print a report that itemises each city the route passes through, together with the route names and the mileage of each leg.
The input has two parts.
The first part is a map given as a list of highway segments. Each segment is one line of four comma-separated fields:
Every highway segment may be travelled in either direction. The list of segments is terminated by an empty line.
The second part is a list of (departure point, destination point) pairs, one per line, written as departure,destination. Every city named here also appears in the map, and a path always connects the two cities. This list runs to the end of the input.
Print one report for each pair, in the order the pairs are given.
Each report consists of:
Total line giving the total mileage.The columns are fixed width and separated by a single space: From and To are 20 characters wide and left-justified, Route is 10 characters wide and left-justified, and Miles is 5 characters wide and right-justified.
Two blank lines precede each report, except that a single blank line precedes the first report.
There are no extraneous blanks in the input. The map has at most 100 cities and at most 200 highway segments, and the total length of each shortest route fits in a 16-bit integer. For every pair, the shortest route is unique.