# Practice on Toph

Participate in exhilarating programming contests, solve unique algorithm and data structure challenges and be a part of an awesome community.

# Crayons

Five friends A, B, C, D and E has come to a shop to buy crayons for their art project. They need crayons of N_{a}, N_{b}, N_{c}, N_{d} and N_{e} distinct colors respectively. The shop has a strange rule. There are M crayons in the shop arranged in a row numbered from 1 to M. If you want to buy crayons, you have to choose two numbers L and R where 1 ≤ L ≤ R ≤M and then you have to buy all the crayons numbered from L to R.

Each of five friends wants to choose L and R in such a way that he gets equal to or more than the number of colors of crayons he needs. But they are not so good in calculation. So they called their programmer friend, you!

They will give you Q queries. In each query one of five friends will ask you if he chooses L and R, will he get equal to or more than the number of colors of crayons he needs?

Write a program that will answer each of those queries.

## Input

First line of the input contains five integers N_{a}, N_{b}, N_{c}, N_{d} and N_{e}. Each of these integers will be in the range [1,10^{5}].

Second line of the input contains two integers **M** (1 ≤ M ≤ 10^{5}) and **Q** (1 ≤ Q ≤ 10^{5}) where M is the number of crayons and Q is the number of queries.

Third line of the input contains M integers C_{1}, C_{2}, C_{3}, …, C_{M} where **C _{i}** (1 ≤ C

_{i}≤ 10

^{9}) represents the color of the i-th crayon.

Each of the next Q lines will contain a query of the form: `X L R`

.

Here X is a character from the set {A, B, C, D, E} indicating which friend is doing the query.

**L** and **R** (1≤ L ≤ R ≤ M) are integers.

## Output

For each query of the form `X L R`

print a single line of output.

If X can get his required number of colors of crayons or more than that by choosing L and R then print “Yes”. Otherwise, print “No”.

## Sample

Input | Output |
---|---|

1 2 3 4 5 10 5 1 4 2 1 1 5 2 7 8 7 A 3 3 B 4 5 C 2 7 D 7 10 E 5 10 | Yes No Yes No Yes |

Login to submit