Many polynomials can be written as the product of several factors, where each one of them is itself a polynomial with integer coefficients. In general, this decomposition can be made in many different ways. For instance, Given two products of polynomials with integer coefficients, please tell if they represent the same polynomial.
Input consists of several cases. Every case has two decompositions of a polynomial, each on one line. The format is exactly as shown in the sample input. The terms inside each factor are given in decreasing order. The terms with coefficient zero are omitted. The degree of every factor is at most 9. No factor is zero. The coefficients are not larger than in absolute value. The represented polynomials have degrees not larger than 1000, and coefficients not larger than in absolute value.
For every case, print “yes” if the two polynomials are
the same, or “no” otherwise.
Input
(+ 2x^4 - 3x^3 + 1x^2 - 9x^1 - 15x^0) (+ 1x^3 + 1x^2 + 3x^1 + 3x^0)(+ 2x^1 - 5x^0) (+ 1x^3 + 1x^2 + 3x^1 + 3x^0)(+ 2x^1 - 5x^0) (+ 1x^2 + 3x^0)(+ 1x^1 + 1x^0)(+ 2x^1 - 5x^0) (+ 1x^2 + 3x^0)(+ 1x^1 + 1x^0)(+ 2x^1 - 5x^0) (+ 1x^3 - 1x^2 + 3x^1 - 3x^0)(+ 2x^1 - 5x^0) (+ 1x^4 - 1x^0) (+ 1x^2 - 1x^0)(+ 1x^2 + 1x^0) (+ 50000x^0)(- 20000x^0) (- 1000000000x^0) (+ 1000000000x^8)(- 1000000000x^8) (- 1000000000x^7)(+ 1000000000x^9)
Output
yes yes no yes yes yes