Testing
Ulyana, a girl who frequently tackles programming problems, knows that after writing a solution, testing is crucial. While she easily devises various tests, she often finds that they violate the constraints outlined in the problem statement.
For Ulyana, this is a challenge, but for you, it's an opportunity. Your task is to verify whether the test she has created adheres to the problem's constraints.
The constraints are provided in TeX format, comprising both text and formulas. Formulas are enclosed either by single dollar signs (e.g., $1 < a < 100$
) or double dollar signs (e.g., $$1 < a, b < n$$
). Each formula follows one of these structures:
<values> <sign> <value> <value> <sign> <values> <value> <sign> <values> <sign> <value>
In these structures, <value>
represents either a number or a variable, <values>
is a list of one or more variables separated by commas, and <sign>
is an inequality sign: <
, >
, \le
(≤), or \ge
(≥). There can be any non-zero amount of whitespace (spaces, tabs, line breaks) between different parts of a formula and between the signs that delimit the formula and its components. There is at least one character separating different formulas. The dollar signs appear only at the boundaries of formulas in the input file. The input file contains a total of variables, named . All numbers in the formulas are integers and do not exceed in absolute value.
Input
The first line of the input file contains a single integer , representing the number of variables in the test for the problem . The second line lists the values of these variables in the order , where is the -th letter of the Latin alphabet.
From the third line onward, the text is provided. It is guaranteed to be correct and contains only the specified formulas.
The input file contains no more than characters, including spaces and line breaks. All numbers within the formulas, as well as the variable values, are integers and do not exceed in absolute value.
Output
Print "Correct" if the test meets the constraints. Otherwise, print "Incorrect" on the first line, followed by the numbers of the formulas where the constraints are violated, one per line in ascending order. Formulas are numbered sequentially starting from one, based on their order of appearance in the input file.