LAMAbpo is a Lithuanian organization which decides whether to admit the student to university or not. In this task your are required to write an application for a part of the LAMAbpo system. Given the score for each of the study programmes included in the application of high-school graduates you have to find the results of the admissions. Essentially, the application includes: the list of study programmes ordered by priority from highest to lowest (application entry) and the personal data of a graduate. The contest is performed as indicated in the rules below: • First, the highest priority study programme is considered. If the contestant’s score is enough, then he is admitted to this course and other courses are not considered. • If the score is not enough the next study programme in the application is considered. • The algorithm proceeds until the application entry is found where the contestant meets the re- quirements (i.e. the score is big enough) or all entries are marked as considered. Be aware, that if you mark an entry as considered you must be sure that either a contestant may not be accepted to the study programme or he must be accepted to this study programme. Input You are given a single test. The test starts with a number of study programmes S and a number of high-school graduates M. S and M are separated by a single space. Then a list of study programmes follows. Each study programme description consists of 2 lines: • Title of a study programme (a string with at most 200 ASCII characters) • A string with 2 numbers separated by a single space — programme identification code I (1 ≤ I ≤ 1000) and a number of students to admit study programme A (0 ≤ A ≤ 35000), respectively. There may not be 2 programmes with the same identification code in the input file and total number of entries of all study programmes will not exceed E (E ≤ 200000). The description of the study programmes is followed by M applications. Each application consits of the following lines: • First name and last name of a high-school graduate (at most 100 characters) • The number of study programmes L indicated in the application by the graduate and a unique positive integer U (U ≤ 109) given to a contestant (which is considered if 2 contestants have the same score) separated by a space. • L (L ≤ 16) lines containing the identification code of a study programme and the contestant score G (G ≤ 10000) with at most 2 digits after decimal point. The numbers are separated by a single space. Score may not be negative. The study programme may not appear in the same application more than once. There will be no identification code with the study programme that does not exist.
2/2 Output You have to output a list of study programmes in order as they appear in the input file with the following information: • Name of the study programme on a single line • Number of admitted contestants (this number may be less than the number of available places) • A list of contestants admitted to the study programme. Each line in this list consists of the first and last name of a contestant. List must be ordered by contestants’ score with highest first. If 2 contestans have the same score then a contestant with a highest number U should be first. Each name is preceded by a number indicating a place of the graduate in the list and a space character (refer sample output). Sample Input 24 Informatika 620 2 Matematika 621 1 Simas Simaitis 2 9529032 620 10.5 621 10.0 Jonas Jonaitis 1 3984329 621 11.5 Erika Erikaite 2 2499345 621 11.5 620 11.5 Vaclovas Vaclovaitis 2 1451044 621 9.5 620 20.5 Sample Output Informatika 2