#C4316. Grade Filtering
Grade Filtering
Grade Filtering
You are given a list of students with their corresponding grades and a target grade. Your task is to output the names of all students whose grade matches the target grade.
The input starts with an integer n which represents the number of students. The next n lines each contain a student's name and their grade separated by a space. Following this, there is one line containing the target grade. Your program should print the names (in the order of appearance) of all students whose grade equals the target grade, separated by a space. If no student matches, output an empty line.
Note: The names and grades will not contain spaces. Use appropriate input/output methods as the input is given via stdin and output is expected on stdout.
inputFormat
The first line contains a single integer n (0 ≤ n ≤ 105), representing the number of students.
The next n lines each contain two strings: a student's name and the student's grade, separated by a space.
The last line contains the target grade (a string) to search for.
outputFormat
Output a single line containing the names of the students whose grade matches the target grade, separated by a single space. If no student has the target grade, output an empty line.
## sample5
Alice A
Bob B
Charlie A
David C
Eva B
A
Alice Charlie