Equivalence#732

Equivalence

1 second
256 megabytes
Hard

Schoolboy Beka discovered that the same mathematical relation can be written in different forms. For example, x \geq 25 can also be expressed as x-25 \geq 0, 25 \leq x, or even 2*x-3*y-12 > x-y*3+13. Beka began verifying the equivalence of various relations given in a large mathematics problem book. Two relations are considered equivalent if, for any set of values of the variables used in these relations, both are either true or both are false (that is, their truth values always coincide).

Beka wanted to check the equivalence of all the relations in the book, but he soon realized that he needed a program to speed up this process. As he cannot program, he asks for your help.

You are required to write a program that, given two relations, determines whether they are equivalent, outputting either YES or NO. Each relation is given as a string. The comparison operator may be one of the following: , , , , , or . The operands in the expressions that make up the left and right sides of a relation may only be single-character variables , , , or at most two-digit decimal numbers (possibly with a leading zero). The expressions may use the following operation signs: , , .

Input

The input file contains two lines, each satisfying the given constraints. Each line contains one relation.

The length of each line is at least and at most characters. In the sequence of operation signs, for both the left and right sides, the multiplication sign may not appear twice in a row. The lines contain no spaces. In an expression, a variable may only be multiplied by a number, and similarly, a number may only be multiplied by a variable.

The tests guarantee that the relations are properly given: each relation contains exactly one comparison operator, and both sides are provided in accordance with the given constraints.

Output

The output file should contain a single line. This line should contain YES if the two lines are equivalent, otherwise NO.

Examples

Example 1

Loading
Loading