Problem list
Log in
#r03343 · Online Judge > GoldOJ

Rank Tier Lookup

Silver III 2.0 s 1024 MB

There are $N$ tiers; tier $i$ has an upper rating bound and applies to any player whose rating is at most that bound but above the previous tier's bound. Bounds are distinct and given in ascending order. For each of $M$ players, print the name of the tier they receive.

Input

First line $N$ and $M$; then $N$ lines each with a tier name and its rating upper bound (ascending, distinct); then $M$ lines each a player's rating ($1 \le N, M \le 10^5$).

Output

Print each player's tier name, one per line.

Example 1

Input
5 6
unranked 1249
bronze 1499
silver 1849
gold 2199
platinum 1000000000
2200
1200
1000000000
1250
1500
1249
Output
platinum
unranked
platinum
bronze
silver
unranked
Source
Online Judge > GoldOJ
Appears in
Not part of a ladder, contest or set yet.
Accepted 0 Submissions 0 Acceptance 0% Solvers 0

Discussion

Threads about this problem. Spoilers are collapsed; wrap hints in ||double bars||.

No discussion yet. Start a thread if something here needs explaining.

Recent submissions Open with filters
Code