#K93912. Order Fulfillment Verification
Order Fulfillment Verification
Order Fulfillment Verification
You are given an inventory of books and a series of customer orders. Each book is identified by its ISBN and has a specified available quantity. Each order consists of a list of ISBNs that a customer wishes to purchase. For every order, you need to determine if the order can be completely fulfilled with the available inventory (i.e. each requested ISBN in the order is available in at least the required number of copies).
Note that the inventory is not permanently depleted by fulfilling an order; every order is checked against the original inventory separately.
Input Format: Details below.
Output Format: Print "YES" if the order can be fulfilled and "NO" otherwise.
inputFormat
The input is read from standard input and has the following format:
n isbn_1 qty_1 isbn_2 qty_2 ... isbn_n qty_n m k1 isbn_a1 isbn_a2 ... isbn_ak1 k2 isbn_b1 isbn_b2 ... isbn_bk2 ... km isbn_c1 isbn_c2 ... isbn_ckm
- The first line contains an integer n representing the number of distinct books in the inventory.
- The next n lines each contain an ISBN (string) and an integer quantity available.
- The following line contains an integer m representing the number of orders.
- Each of the next m lines starts with an integer k indicating the number of books in that order, followed by k ISBNs separated by spaces.
outputFormat
For each order, output a single line that is either "YES" if the order can be fulfilled, or "NO" if it cannot.
## sample1
978-3-16-148410-0 10
1
1 978-3-16-148410-0
YES
</p>