#C6634. Course Recommendation System

    ID: 50416 Type: Default 1000ms 256MiB

Course Recommendation System

Course Recommendation System

Given a list of courses with their respective prerequisite topics, and a set of topics that a student has mastered, determine which courses the student is eligible to take.

For a course with a set of prerequisites \( P \), the student qualifies for the course if and only if for every \( p \in P \), we have \( p \in M \) where \( M \) is the set of mastered topics. That is, the course is eligible if \( P \subseteq M \).

This problem requires you to process input from stdin and write the output to stdout.

inputFormat

The input is provided via stdin and has the following format:

  1. An integer \( n \) representing the number of courses.
  2. \( n \) lines, each line describing a course. The first token on each line is the course name (a string), followed by zero or more prerequisite topics (each a string) separated by spaces.
  3. An integer \( m \) representing the number of topics the student has mastered.
  4. A single line containing \( m \) space-separated strings representing the mastered topics. (If \( m = 0 \), this line may be empty.)

outputFormat

The output should be printed to stdout and contain the list of course names (one per line) for which the student satisfies all the prerequisites, in the order they were given in the input. If no course is eligible, output nothing.

## sample
1
Course1
0
Course1

</p>