Removing an item

Sometimes dictionaries get big and some keys are not necessary anymore. We can get rid of them with a del command:
furniture =  {
	'table': 2,
	'chair': 5,
	'lamp': 8,
	'phone': 4,
}
# This was an old building, so they used old phone system there
# After renovation, phones are not necessary anymore
del furniture['phone']
print(furniture)    # {'table': 2, 'chair': 5, 'lamp': 8}

Challenge

Given n pairs of student names with their corresponding GPAs, you are asked to remove the ones who have already graduated from the university (the list of graduates might contain some names that have already been removed).
The first line of the input contains a single integer n - the number of students. The next n lines contain student names and their GPAs separated by a space. The next line contains space-separated student names who have graduated from the university.
The program should print the resulting list of students with their corresponding GPAs each on a separate line, where the student name and the GPA are separated by a space.
Input
Output
8 Lucy 3.8 Anna 4 Bob 4 Steven 3 Kevin 2 Lily 3.9 Simon 2 Sophy 2.5 Anna David Steven Lukas Bob
Lucy 3.8 Kevin 2 Lily 3.9 Simon 2 Sophy 2.5
 

Constraints

Time limit: 2 seconds

Memory limit: 512 MB

Output limit: 1 MB

To check your solution you need to sign in