During the warmup session of Programadores de América (PDA) in Santiago de Chile, Ezequiel notices something alarming: the scoreboard looks blurry. Worried that the same thing might happen during the actual contest, he decides to quickly take an eye exam.
The optometrist runs a series of tests to find Ezequiel's true prescription, which is an integer $$$x$$$. Unfortunately, instead of carefully narrowing down the prescription, the optometrist uses the lenses in no particular order. Thus, in each test Ezequiel is shown two lenses with different correction degrees $$$A$$$ and $$$B$$$ ($$$A \lt B$$$), and he must tell his opinion about which lens is better. For each test Ezequiel answers:
After running the tests in such a strange way, the optometrist does not know what to do with Ezequiel's answers, so they need your help. Given the results of all tests, you must determine the minimum and maximum integer prescriptions that are consistent with the tests. If no integer prescription is consistent with the tests, you must report it.
The first line contains an integer $$$N$$$ ($$$1 \leq N \leq 1000$$$) indicating the number of tests.
Each of the next $$$N$$$ lines describes a test with two integers $$$A$$$ and $$$B$$$ ($$$1 \le A \lt B \le 1000$$$), followed by an uppercase letter $$$C$$$ (either "A", "B" or "E"), where $$$A$$$ and $$$B$$$ are the correction degrees of the lenses and $$$C$$$ is Ezequiel's answer.
It is guaranteed that there is a finite number of integer prescriptions that are consistent with the tests.
Output a single line with the character "*" (asterisk) if no integer prescription is consistent with the tests. Otherwise, output a single line with two integers indicating the minimum and maximum prescriptions that are consistent with the tests.
11 31 E
16 16
21 31 A1 31 B
*
31 5 B1 11 A1 5 B
4 5
13 4 E
*
Explanation for example 1
The only integer prescription that is equally close to $$$1$$$ and $$$31$$$ is $$$16$$$.
Explanation for example 2
No integer prescription is consistent with the tests, because it should be strictly closer to both $$$1$$$ and $$$31$$$.