| 
 
 
 | Лимит времени 2000/4000/4000/4000 мс. Лимит памяти 65000/65000/65000/65000 Кб. Question by Ibrahim Mesecan.
 
 
   Trip to KorcaQuestion: 
TraveLovers club is organizing a trip to Korca. 
You have the full students list. Then, you will be 
given m student IDs who are participating to the trip. 
Show sorted list of participating students according 
to department codes. If there are several students 
from the same department, show students according to 
grade attending (and name, then surname) in ascending order.
 Input specification  You will be given two integers in the beginning: 
the number of students (n) and the number students 
(m) who are participating to the activity. Then, 
in the following n lines you will be given n student 
information which is sorted according to IDs:
 
where 0 ≤ m ≤ n ≤ 40,000.Student ID: an integer not greater than 500,000Name and surname: at most 15 chars strings 
(separated by a space)Department code: at most 5 chars string 
(some possible codes are CEN, ECE, BINF, etc.)Grade attending: integer between 1 and 5 
where 1 means first grade (year) student, etc. Output specification: Show department, grade, name and surname of the 
students who are participating.
 
  
| Sample Input I 
 
10 54 Dominic Allison BINF 1
 7 Moses Mendez CEN 4
 9 Alison Burns CEN 3
 13 Marilyn Patterson ECE 3
 18 Jean Bass BINF 4
 20 Cora Duncan ECE 3
 24 Marta Roberson BINF 3
 25 Jill Flores ECE 1
 28 Carla Holmes CEN 2
 32 Mike Johnston ECE 1
 20 7 32 13 9
 
 | Sample Output I 
 
CEN 3 Alison BurnsCEN 4 Moses Mendez
 ECE 1 Mike Johnston
 ECE 3 Cora Duncan
 ECE 3 Marilyn Patterson
 
 |  
 Для отправки решений необходимо выполнить вход.
 
 
 |