D: 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
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
A map is represented with several input lines:
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 texts for each input case are presented in the same order that
input is read.
For each pair of maps named < id1 >
YES: < id2 >
must be written. In other case, the output must be of the form
NO: < id2 >
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
Output
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