A paleontology field team logs every fossil specimen it unearths on a numbered index card. Each card records a unique catalog number, the species name, and the specimen's estimated age in millions of years. The lead archivist hands you the requested catalog number for the day and needs to know, at a glance, exactly what that card says. Given the full stack of cards and one catalog number to look up, report the species name and age written on the matching card -- or, if no card in the stack carries that catalog number, report that it could not be found.
n — the number of cards.n lines describes one card as catalogId name age, where catalogId is an integer, name is a lowercase alphabetic string with no spaces, and age is an integer (millions of years).target — the catalog number to look up.All catalogId values among the n cards are distinct.
If some card's catalogId equals target, print that card's name and age separated by a single space. Otherwise, print exactly NOT FOUND (no quotes).
1 <= n <= 10001 <= catalogId, target <= 10^61 <= length of name <= 20, consisting only of lowercase English letters a-z1 <= age <= 1000Example 1
Input
3 101 trex 66 102 stego 150 103 raptor 75 102
Expected
stego 150
Explanation
There are three cards. The target catalog number is 102, which matches the second card: name 'stego', age 150. So the output is 'stego 150'.
Example 2
Input
2 5 amber 10 9 quartz 20 7
Expected
NOT FOUND
Explanation
There are two cards with catalog numbers 5 and 9. The target is 7, which matches neither card, so the output is 'NOT FOUND'.
Ready to solve this?
Sign in to open the editor, run your code against the sample tests, and submit against the full test suite.
Sign in to solve →