Submit | All submissions | Best solutions | Back to list |
AKVMSFT1 - Help the Librarian of ISM 200 Points |
The Librarian of ISM Dhanbad needs your help. He will tell you the value of “N”, the number of books that he has in the library and the codes of all the books. There can be more than one book with the same code. The Code of a book is an integer between 1 and 1000 (both 1 and 1000 inclusive). Now on a particular day, “S” number of students will come to the library to borrow books. Each of them will ask for a particular book code “Ai” (1 <= i <= S), if the book exists in the library, you should issue that book to him. Otherwise you should tell him that the book is not available.
Input
First line of the input will contain “N”, the number of books present in the library. The next line will contain “N” integers denoting the codes of all the books. The next line will contain “S”, the number of students that will come to the library on that particular day. Each of the next S lines will contain an integer “Ai”, denoting the code of the book that he wants.
Output
For each student, output in a separate line “YES”, if the book is issued to him, otherwise print “NO”.
Constraints
1 <= N, S, Ai <= 1000
Example
Input: 5 1 2 3 1 5 6 3 4 1 1 5 1 Output: YES NO YES YES YES NO
Added by: | Ankit Kumar Vats |
Date: | 2013-09-04 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ASM64 |
Resource: | Self |