After a chilly snowball fight, Elsa and Anna return to their castle to dry themselves off. They are greeted by the smell of their favorite dishes wafting out from the dining hall; the Christmas dinner is ready! They run into the dining hall and see a row of platters arranged along the long, wooden dinner table.
Anna excitedly taps Elsa on the shoulder and exclaims:
Look at those platters of roast beef, potatoes, corn, pudding and gingerbread! Yummy~
Indeed, there exists several plates filled with a variety of nourishment, my sibling. More specifically, I have observed that there are platters, each of them containing the -th type of food . Upon further careful observation of the behaviour of the guests, I have come to the following conclusion: To get food, one lines up with their plate, initially empty, at the beginning of the table, and walks, starting from the st dish, forward along the table. At each dish from to , one can either choose to stack the -th food on top of their plate (i.e. on top of everything before it), or they can skip over it. However, one cannot turn backwards, and once they finish walking along the table, they cannot go back.
Wow, cool! Do ya think I can get my plate to be stacked in a specific way, just how I like it?
She then proceeds to list orders, where the -th order consists of dishes, in order from top to bottom of the finished plate. Please help Elsa determine whether each of Anna's orders is possible to stack.
The first line will contain two integers, and .
The second line will contain integers, representing .
On the next lines, there will first be an integer , then integers, representing Anna's order, from top to bottom.
For each order, output
YES if the order can be made, or
Sample Input 1
6 4 5 5 1 2
3 2 4 6
4 2 5 4 5
2 5 5
Sample Output 1
Sample Explanation 1
For the first query, Anna can pick up food from plates , , and .
For the second query, there is no possible way (especially since the two 's are consecutive in the plates, but they are separated by a in her order).
For the third query, Anna can pick up food from plates and .