DRM

DRM Inc. is a firm that produces digital road maps. A digital map is a set of places and a set of streets between places. Streets are not oriented, i.e., they are two-way streets. A road between a place a and a place b is a sequence of places ⟨u0,u1,...,un⟩ such that a = u0, b=un,andthereisastreetbetweenui andui+1 for0≤i<n. The definition of a map is accomplished incrementally: a new version of a map is built adding details to an already defined one. The new map must be consistent with the old one, i.e., the new one must be more detailed than the old one, in the sense that • the new map has at least the same places than the old one; • for every street between places u and v in the old map, in the new one there is a road between u and v. Any intermediate place of this road must be a new place (not considered in the old map). DRM building process includes a comparison step between consecutive map versions in order to assure consistence between them. You must help DRM to evaluate if a map is more detailed than another one. Input A map is represented with several input lines: • the first line contains an identifier for the map • the following lines, except the last one, contains identifiers of two places that define a street between them. Identifiers are separated with a blank character. It is guaranteed that a street is described only once, but places naming it could be given in any order. On the other hand, streets are named without any specific order. • the last line contains the string ‘* * *’ (star, blank, star, blank, star). An identifier is a character string without blanks. The problem input describes several cases, each one consisting of a pair of map representations. For each case you must evaluate if the second map of the given pair is a more detailed version of the first one. The end of the input is specified by a line with the word END. Output Output texts for each input case are presented in the same order that input is read. For each pair of maps named < id1 > and < id2 >, if the map named < id2 > is more detailed than the map named < id1 >, an output line of the form YES: < id2 > is a more detailed version of < id1 > must be written. In other case, the output must be of the form NO: < id2 > is not a more detailed version of < id1 >

2/2 Sample Input COL1 Bogota Cali Bogota Barranquilla *** COL2 Barranquilla Bogota Armenia Cali Barranquilla Armenia Bogota Cali Cali Barrranquilla *** COL1 Bogota Cali Bogota Barranquilla *** COL3 Bogota Armenia Armenia Cali Cali Medellin Medellin Barranquilla *** END Sample Output YES: COL2 is a more detailed version of COL1 NO: COL3 is not a more detailed version of COL1