The wages of the employees of a company are computed on the basis of a set of relative rankings of the form x R y, where x and y are names and/or numbers, and R is a relational operator from the set {<, <=, >, >=, =}. Themeaningofx R yis:
the salary of x number x
must be in relation R with
the salary of y number y
The problem is to compute the minimum and the maximum wage which each of the employees can get according to a given set of relations. It is known that: the name of an employee is at most 8 characters long; the wages are integers from 1 to 99999; only integer numbers appear in relations; the number of employees cannot exceed 100 and the number of relations is at most 1000.
Input
The program input is from a file which contains several sets of relations as shown in the sample input below. The relations of a set are one on a line and their elements are separated by spaces. Each set of relations ends with a line which contains a minus sign only. The format of input data is correct.
Output
The result of the program is on standard output. For each consistent set of relations the result is the message ‘OK’ followed by the list of employees (if any), in alphabetical order, together with their minimum and maximum wages as shown in the sample output. If a set of relations is inconsistent then the message ‘No solution’ is printed for that set. Notice that for a set of relations which contains only numbers the result can be either the message ‘OK’ or ‘No solution’.
Print a blank line between two consecutive test cases.
Sample Input
Fido < 20 Bibo <= Fido Fred < Bibo 20 > Fred