Equivalence
Schoolboy Beka discovered that the same mathematical relation can be expressed in various forms. For instance, "x>=25" can also be written as "x-25>=0", "25<=x", or even as "2*x-3*y-12>=x-y*3+13". He started examining the equivalence of different relations found in a comprehensive mathematics problem book. Two relations are considered equivalent if, for any set of variable values, both relations are either true or false simultaneously (i.e., their truth values are always the same).
Eager to verify the equivalence of all the relations in the book, Beka quickly realized he needed a program to expedite this task. Since he doesn't know how to program yet, he is seeking your assistance.
Your task is to write a program that, given two relations, will determine if they are equivalent, outputting either YES or NO. Each relation is provided as a string. The comparison operators can be one of the following: < <= > >= = <>. The operands in the expressions forming the left and right sides of the relation can be either two-character combinations like X0, X1, ..., X9, representing variables, or decimal numbers up to two digits long (possibly with a leading zero). The operators in the expressions can be: - + *.
Input
The input file contains two lines that adhere to the given constraints. Each line contains one relation following the specified conditions.
The length of each line containing the relation is at least 3 and no more than 1000. In the sequence composed solely of operation signs for both the left and right parts, the multiplication sign cannot appear consecutively. The lines do not contain spaces. In the expression, a variable can only be multiplied by a number, and similarly, a number can only be multiplied by a variable.
The tests guarantee that the relations are correctly formatted. Each relation has exactly one comparison operator, and both the left and right parts are structured according to the conditions.
Output
The output file should contain a single line. This line should begin with the text YES if the relations are equivalent, and with NO if they are not.