Key Lookup


Submit solution

Points: 10
Time limit: 2.0s
Memory limit: 256M

Author:
Problem types

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:score pairs 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


  • 0
    admin  commented on July 16, 2026, 7:10 p.m.

    ngon luôn