TLE '17 Contest 6 P2 - Mr. More-than-perfect

View as PDF

Submit solution


Points: 5 (partial)
Time limit: 2.0s
Memory limit: 256M

Author:
Problem type
The header is missing information, but this paper definitely can't be your friend's.

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 N 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 \dfrac{x}{n} > 100\% 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 N (1 \le N \le 10), the number of papers in the pile.

The second line of input will contain a string containing no more than 20 lowercase English characters, which specifies your friend's name.

The next N 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 2 \le x \le 1\,000, 1 \le n \le 1\,000 and that names will contain no more than 20 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

There are no comments at the moment.