A group of Z friends is going to the movies. They have already reserved some specific locations in the theater. As a kind of ritual, every friend likes to drink something while seeing the film. Locations at the theater are disposed in a rectangular array of R rows and C columns. Rows are named sequentially with English capital letters (‘A’, ‘B’, ‘C’, ...). Columns are named with integers (1, 2, 3, ..., C). Then, locations are identified by a string formed by the corresponding row letter and column number of the location. Locations at the theater are chairs with plastic supports at both arms, to put a drink on each one. Supports are shared by neighbor locations but, of course, it is expected that at most one person uses a support to put his/her drink, but there is no etiquette rule that forces someone to use the right or the left support of his/her chair. As a matter of example, the next figure illustrates a theater with 3 rows and 5 columns. Locations are depicted with rectangular forms, and supports with circles at both sides of them. The group of friends goes to occupy the reserved locations. Before them, some persons came and occupied some of the locations (different from those of the group) and everyone used one support for a drink. Is it possible that the group of friends sit at their locations warranting that everyone in the group can put his/her drink on a support that corresponds to his/her location? Clearly, sometimes the spectators that came before the group may have used the supports in such a way that not everyone in the group may use a support for his/her drink. Input There are several cases to consider. Each case begins with a line with two integer numbers R and C, indicating the number of rows and columns in the theater (1 ≤ R ≤ 26, 2 ≤ C ≤ 99). The next line contains an integer number P indicating the number of persons that came to the theater before than the group (0 ≤ P ≤ R · C − 1). Each one of the next P lines contains two text strings; the first one corresponds to the location id (one letter, one integer numeral) and, the second one is an one-character string with a sign ‘-’ or a sign ‘+’ denoting the fact that the person is using the left or the right support of his/her location, respectively. The next line contains an integer number Z indicating the number of persons in the group of friends (1 ≤ Z ≤ R · C − P ). Finally, each one of the following Z lines contains the locations’ ids of the reserved seats for the group of friends. In each case, you may suppose that the given identifiers are distinct and that every drink was put in an empty support before the friends came. Each line in a case description has no leading spaces and items on a line are separated by exactly one space. There are no spaces at the end of any line. Input ends with a line with two ‘0’ values. Output For each case output a line with one of the texts ‘YES’ or ‘NO’ depending on the fact that the group of friends can occupy their seats and use some of the supports to place their drinks with the constraints imposed by the already occupied seats and supports.
2/2 Sample Input 35 3 A3 - B1 - B4 - 4 A1 A2 B2 B3 35 3 A3 - B1 + B4 - 4 A1 A2 B2 B3 00 Sample Output YES NO