## Math Class Purge

View as PDF

Points: 3
Time limit: 2.0s
Memory limit: 64M

Author:
Problem types

At Thornhill Secondary school, only the best of the best may be accepted and enrolled into Mr Fraschetti's advanced placement mathematics class. As such, Mr Fraschetti purges those he believes are not qualified to be in the class at the beginning of each semester. Given the list of students who wish to enrol in the class and the purges that Mr Fraschetti makes, determine the final class list in the order of when the students applied.

#### Input Specification

The first line of input contains representing the number of students who wish to enrol in the class.
The next lines each contain , the name of the person who wants to join the class. Their name will be all lowercase letters. The names are given in order of when they applied so that the student applied after the student and before the student.
The next line contains representing the number of people Mr Fraschetti will remove from the class.
The next lines will contain an integer representing the index of the student to be removed in relation to the original list, where the first name is at index 0.

#### Output Specification

Output each remaining student on a new line in the order of when they applied from earliest to latest.

#### Sample Input

4
jonathansumabat
donaldtrump
narwhal
potato
2
0
3

#### Sample Output

donaldtrump
narwhal

#### Explanation for Sample Data

In the beginning, 4 people applied to the AP class. jonathansumabat applied first, followed by donaldtrump then narwhal and potato. Mr Fraschetti purged 2 of these students. First he purged the least competent of them, jonathansumabat at index 0. Then, of the remaining 3 students he purged the one at index 3 where in relation to the original list of 4 students, is potato. In the end, donaldtrump and narwhal remain in the class.