PROGRAMMING:Buying train tickets
We omit many details of purchasing train tickets in reality. For a train, we can query the remaining tickets and purchase tickets according to the entered ticket order information< br>
Seats are reusable, that is, to book a certain section of the journey, only occupy one seat in that section of the journey, and not occupy a seat outside the journey. For example ? :< br>
If a train has Qingdao, Jinan, Tianjin and Beijing stations (Qingdao to Beijing) and 10 seats, then: < br > if the train has 10 seats, it will have 10 seats
(1) If you order one ticket from Qingdao to Tianjin, you should first display 10 tickets and purchase them< br>
(2) Re order 1 Tianjin Beijing ticket, display the remaining 10 tickets, and execute the ticket purchase operation< br>
(3) Re order 9 Jinan Tianjin tickets, display the remaining 9 tickets, and execute the ticket purchase operation< br>
(4) Re order one ticket from Qingdao to Tianjin, show the remaining 0 tickets, and remind you that you can't buy tickets< br>
In order to simplify, tickets sold are not fixed seats and only "seats are available". For example, a train from Qingdao to Jinan to Beijing with only two seats, < br > can be divided into two groups
Passenger a will book a ticket from Qingdao to Jinan, which may occupy seat 0< br>
Passenger B may take seat 1 if he orders another Jinan Beijing ticket (although there seems to be a more optimized scheme to let B take seat 0, this problem does not need to be considered)< br>
Passenger C can book another ticket from Qingdao to Beijing. It seems that there is no vacant seat from Qingdao to Beijing (there are no tickets), but he can sit at No. 0 and No. 1 on the two sections of the journey, so he can still buy the ticket successfully.
###Input format:
In the first line, enter the number of stations' n '('n > 1' and 'n < = 50') and the number of seats's' (positive integer's < = 200 '), with one space in the middle< br>
In the second line, enter 'n' station names (the names are only composed of letters and numbers, and the length is not more than 30), separated by spaces, and the stations are arranged from the starting point to the ending point according to the train running direction< br>
In the third line, enter order quantity ` m '(positive integer ` m < = 50') < br
The next M lines, each line is an order, the content is in turn 'boarding station name alighting station name booking quantity', separated by a space in the middle.
###Output format:
For each order, the booking result is given in one line: first, the remaining tickets of the journey are displayed, and then "yes" or "no" is printed to indicate that the ticket purchase is successful or failed.
###Input example:
```in
4 10
Qingdao Jinan Tianjin Beijing
four
Qingdao Tianjin 1
Tianjin Beijing 1
Jinan Tianjin 9
Qingdao Tianjin 1
```
###Output example:
```out
10 YES
10 YES
9 YES
0 NO
```
answer:If there is no answer, please comment
Seats are reusable, that is, to book a certain section of the journey, only occupy one seat in that section of the journey, and not occupy a seat outside the journey. For example ? :< br>
If a train has Qingdao, Jinan, Tianjin and Beijing stations (Qingdao to Beijing) and 10 seats, then: < br > if the train has 10 seats, it will have 10 seats
(1) If you order one ticket from Qingdao to Tianjin, you should first display 10 tickets and purchase them< br>
(2) Re order 1 Tianjin Beijing ticket, display the remaining 10 tickets, and execute the ticket purchase operation< br>
(3) Re order 9 Jinan Tianjin tickets, display the remaining 9 tickets, and execute the ticket purchase operation< br>
(4) Re order one ticket from Qingdao to Tianjin, show the remaining 0 tickets, and remind you that you can't buy tickets< br>
In order to simplify, tickets sold are not fixed seats and only "seats are available". For example, a train from Qingdao to Jinan to Beijing with only two seats, < br > can be divided into two groups
Passenger a will book a ticket from Qingdao to Jinan, which may occupy seat 0< br>
Passenger B may take seat 1 if he orders another Jinan Beijing ticket (although there seems to be a more optimized scheme to let B take seat 0, this problem does not need to be considered)< br>
Passenger C can book another ticket from Qingdao to Beijing. It seems that there is no vacant seat from Qingdao to Beijing (there are no tickets), but he can sit at No. 0 and No. 1 on the two sections of the journey, so he can still buy the ticket successfully.
###Input format:
In the first line, enter the number of stations' n '('n > 1' and 'n < = 50') and the number of seats's' (positive integer's < = 200 '), with one space in the middle< br>
In the second line, enter 'n' station names (the names are only composed of letters and numbers, and the length is not more than 30), separated by spaces, and the stations are arranged from the starting point to the ending point according to the train running direction< br>
In the third line, enter order quantity ` m '(positive integer ` m < = 50') < br
The next M lines, each line is an order, the content is in turn 'boarding station name alighting station name booking quantity', separated by a space in the middle.
###Output format:
For each order, the booking result is given in one line: first, the remaining tickets of the journey are displayed, and then "yes" or "no" is printed to indicate that the ticket purchase is successful or failed.
###Input example:
```in
4 10
Qingdao Jinan Tianjin Beijing
four
Qingdao Tianjin 1
Tianjin Beijing 1
Jinan Tianjin 9
Qingdao Tianjin 1
```
###Output example:
```out
10 YES
10 YES
9 YES
0 NO
```
answer:If there is no answer, please comment