There are several test cases. Each test case has three parts of input. The first part contains several lines indicating the original marks with the one of the following two formats:
or:
Here M is the mark symbol, and x and y are integers in the range of [0, 100]. The first format means that we don't know the position of the mark. The second format means that we know the position of the mark is (x, y). In this part, one mark will be mentioned at most once.
The second part contains some instructions with the following formats:
Here N (= 1, 2 or 3) indicates which kind of instruction is used. A, B are symbols of the marks you have already had, and C is the symbol of a new mark you will get. You may assume that A and B are different marks and have been mentioned before, and it's the first time for C to show up.
The third part is one line containing a mark symbol, of which we want to know the position. It is assured that this mark has been mentioned before.
A line with "END" indicates the end of the input.
To make it easier, we use 'A', 'B', ... and 'Z' as mark symbols, which implies there are no more than 26 marks.