#K73782. Library Book Availability Checker

    ID: 34052 Type: Default 1000ms 256MiB

Library Book Availability Checker

Library Book Availability Checker

You are given the inventory of a library and several book queries. For each test case, the first number is \(N\), the number of books in the inventory. If \(N = 0\), the input terminates. For each of the next \(N\) lines, two integers are provided: a book identifier and the number of copies available.

After the inventory, an integer \(M\) is given indicating the number of queries, followed by \(M\) lines of book identifiers to check. For each query, output Available if the book exists in the inventory and has at least one copy; otherwise, output Not Available. Each result should be printed on a separate line.

inputFormat

The input is read from standard input (stdin) and consists of one or more test cases:

  • The first line of a test case contains a positive integer \(N\) (\(N > 0\)). If \(N = 0\), then it marks the end of input.
  • The next \(N\) lines each contain two integers: the book ID and the number of copies available.
  • Following that, a line with an integer \(M\) is provided, indicating the number of queries.
  • The next \(M\) lines each contain a book ID to be queried.

outputFormat

For every query, output either Available or Not Available on separate lines. A book is considered available if it exists in the inventory and has at least one copy.

## sample
5
1001 3
1002 0
1003 5
1004 1
1005 2
4
1001
1002
1006
1005
3
1010 7
1011 0
1012 2
2
1012
1011
2
2001 1
2002 0
3
2001
2002
2003
0
Available

Not Available Not Available Available Available Not Available Available Not Available Not Available

</p>