Key Lookup
You are given a dictionary encoded as name:score pairs and a query. Determine whether the query is one of its keys.
Input
- The first line contains n (1 ≤ n ≤ 500000).
- The second line contains n space-separated
name:scorepairs with distinct keys. - The third line contains the query.
Each name and the query starts with an ASCII letter and then contains only ASCII letters or digits. Scores are integers with absolute value at most 10^9.
Output
Print YES if the query exactly matches a key; otherwise, print NO. Matching is case-sensitive.
Examples
Input #1
3
Alex:9 Blair:8 Casey:10
Blair
Output #1
YES
Explanation #1: Blair is exactly one of the three keys; the score 8 does not affect membership.
Input #2
3
Alex:9 Blair:8 Casey:10
blair
Output #2
NO
Explanation #2: Keys are case-sensitive: blair and Blair are different strings.
Comments
ngon luôn