62 - ZOJ Monthly, January 2008 - 1001
Holding a programming contest is very hard. You have to find a place that is large enough to hold the contest. You have to get a lot of balloons and arrange several pretty girls to send them. You have to prepare the gifts for the winners. You have to collect several problems and check the answers. And what's more, you have to choose some good problems and title them to set up a problem set. Facing such problems, the chief judge ask you to help him to set up a good problem set.
Given the evaluation, resources needed and the key words of each problem, your task is to choose K problems and title them to set up a problem set that satisfies the following conditions:
The first line of each test case contains three integers, N, M, K, indicating the number of problems you collect, the number of insignificant words and the number of problems you must choose.
The second line contains the M insignificant words.
The following N lines discript the N problems in the following form:
The input satisfy the following constraints:
Output the problem list in the form of [ID] Title, one problem in a line. ID begins with 1001. If the problem set can't be set up, just output"Impossible" in one line. There must be a blank line separating two contests, but no extra line at the end of output.
4 5 4 a an and in of 7 8 2 ac dasher 6 9 2 beasts beauty 7 6 1 cai 6 7 1 dollars 3 0 2 1 1 2 a b 1 1 2 hello world 1 1 3 read after me 0 0 0
 Ac Dasher  Beasts and Beauty  Cai in  Dollars Impossible
Author: GUAN, Yao