## Problem F: Factorial Products

For the purpose of this problem, we will define a "factorial product" to be a multiplication of several factorials of single digit numbers.

For example, the expression 5! * 3! * 4! * 3! is a product of four factorials, where each factorial is generated by a single digit. Given two factorial products, are they equal?

### Input Format

The input will contain multiple test cases (at most 100). Each case starts with two integers N and M on a line (1 ≤ N, M ≤ 1,000), the number of factors in each factorial product. The next line contains N digits, each digit being between 0 and 9 inclusive, specifying the generators of the N factorial factors in the first product. The third line contains M digits, also between 0 and 9, specifying the generators of the M factorial factors in the second product.

For instance 5! * 3! * 4! * 3! would be given as 5 3 4 3.

Input will end with a line containing two zeroes.

### Output Format

For each expression print on a separate line either "YES" or "NO", the answer to the question "Are the two factorial products equal?"

```1 1
9
9
1 2
5
3 6
0 0
```

```YES
NO
```

Peter Høyer
ACPC 2013