Lex Fridman hosts a very interesting podcast where he calls different guests like Elon Musk, Joe Rogan, Andrej Karpathy, and Vitalik Buterin to name a few. Both you and your friend Anna really enjoy watching the podcasts. When discussing the podcasts, you like talking about the number of views the podcast got and who was the guest. You’ve decided to write that information out and keep it as a list of pairs (guest, views). Now whenever Anna mentions a name of a guest, you can look at the list and find out the number of views that podcast got.
Can you write a program that would print the number of views for all the guests Anna was talking about?
The first line of the input contains a single integer n (1 ≤ n ≤ 1000) - the number of podcasts you’ve kept as a list of pairs.
The next 2n lines contain pairs of guests and views. First comes the name of the guest, then the number of views that the podcast obtained.
The following line contains a single integer q (1 ≤ q ≤ n) - the number of questions Anna has about the podcast guests.
The next q lines are the names of the guests Anna talks about.
For each of the q questions, the program should print the number of views the podcast obtained.
Disclaimer: This method of searching for the right answer is called a linear search. We’ll learn how to perform faster queries for different types of problems in a bit.