#B3819. Volunteer Rotation

    ID: 11476 Type: Default 1000ms 256MiB

Volunteer Rotation

Volunteer Rotation

Every week, several volunteers are responsible for reviewing problem solutions. At the end of each week, a rotation occurs: some of the current volunteers quit, while the remaining ones continue working for the next week. Additionally, a number of new volunteers join the team for the upcoming week.

You are given three sets of information:

  • The list of current volunteers for this week.
  • The list of volunteers who quit this week.
  • The list of new volunteers who will join next week.

Your task is to determine the volunteer list for next week. The list is formed by retaining those volunteers from the current week who do not quit, and then appending all the new volunteers. Formally, if \(C\) is the list of current volunteers, \(Q\) is the list of volunteers who quit, and \(N\) is the list of new volunteers, then the next week's volunteer list is given by:

[ Next = { x \in C \mid x \notin Q } \cup N ]

Print the resulting list as a sequence of names separated by a single space.

inputFormat

The input consists of four lines:

  1. The first line contains three integers n, m, and k, where n is the number of current volunteers, m is the number of volunteers who quit, and k is the number of new volunteers.
  2. The second line contains n space-separated names representing the current volunteers.
  3. The third line contains m space-separated names of the volunteers who quit. If m is 0, this line will be empty.
  4. The fourth line contains k space-separated names of the new volunteers.

outputFormat

Output a single line containing the names of the volunteers for next week, separated by a space. The order should be the same as the order in the original current volunteers list (excluding those who quit) followed by the order of the new volunteers.

sample

5 2 3
Alice Bob Charlie David Eve
Bob David
Fiona George Henry
Alice Charlie Eve Fiona George Henry