Your friend is somehow amazingly consistent at getting more than a perfect score on assignments and exams.
Your professor is handing back some recent papers. You decided to be nice and pick up your friend's papers.
The format of every paper's header is x/n name
where x
and n
are positive integers and name
is a string. x
is the score of the paper and n
is the total score possible.
There are papers in a messy pile, and some of the headers are partially covered, hiding some information. In particular, the right ends of some of the header information could be missing. That is, a suffix of the header could be missing. For example, 55/50 nath
and 33/
are possible covered headers.
Given your friend's name and knowing that he must have papers where and a name that matches up with a prefix of his name, could you determine which papers could possibly be his?
Input Specification
The first line of input will contain , the number of papers in the pile.
The second line of input will contain a string containing no more than lowercase English characters, which specifies your friend's name.
The next lines of input will each contain a string in the form x/n name
, but the right ending characters might be cut off. It is guaranteed that , and that names will contain no more than lowercase English characters. It is guaranteed that there will be at least one character per line.
Output Specification
On a separate line for each paper, output Y
if there is any possibility that the paper could be your friend's, or N
if it cannot.
Sample Input
5
morethanperfect
11/10 adam
12/5 morethanper
8/8 morethan
10/3
20
Sample Output
N
Y
N
Y
Y
Comments