036. Speed Limits
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output

You are going on a long road trip, and want to know what the maximum speed limit is in each state that you are traveling through.

Input

The first line of input contains a positive integer S, indicating the number of states that are in the database. The next S lines each contain a string representing the name of the state, a space, and an integer representing the maximum speed limit in that state. Names of states will not contain spaces. The next line of input contains a positive integer T indicating the number of test cases that follow. Each test case will consist of a state name.

Output

For each of the T test cases, output a single integer: the maximum speed limit in the given state, from the database.

Example
Input
6
NewYork 65
Texas 85
Pennsylvania 70
Massachussets 65
Washington 75
Hawaii 60
5
NewYork
Pennsylvania
NewYork
Texas
Hawaii
Output
65
70
65
85
60