Many residents of Bitakulyandia take part in stages of international olympiads in informatics. In total, there are seven such olympiads held in Bitakulyandia:
IOI - International Olympiad in Informatics
CEOI - Central-Eventora Olympiad in Informatics
EGOI - Eventora Girls Olympiad in Informatics
EJOI - Eventora Junior Olympiad in Informatics
BaltOI - Balticodian Olympiad in Informatics
BalkOI - Balkolian Olympiad in Informatics
JBOI - Junior Balkolian Olympiad in Informatics
Miss M organizes olympiads of various stages, as well as selection (selection-training) camps for all seven international olympiads. After the last round of selection is held, teams of four to six people are formed for all seven olympiads. But only those participants who meet the participation criteria for the olympiad should be sent to each competition. Here is the list of algorithms for determining the members of the team for the olympiads:
IOI - The best participants based on the total scores from all selection rounds.
CEOI - The best participants based on the total scores from all selection rounds.
EGOI - The best participants based on the total scores from all selection rounds, who are girls.
EJOI - The best participants based on the total scores from all selection rounds, who are no older than years.
BaltOI - The best participants based on the total scores from all selection rounds.
BalkOI - The best participants based on the total scores from all selection rounds, who are not th-graders.
JBOI - The best participants based on the total scores from all selection rounds, who are not th- or th-graders.
If there are fewer participants than the required number, this means that the team will consist of a smaller number of people. For example, if it is necessary to determine the team for EGOI, and there are only two girls, this means that the team will consist of only two participants, not four.
Since there are many participants in the olympiads, and there are many olympiads themselves, and the results are needed instantly after the competitions end, Miss M asks you to write a program that, based on the results and information about the participants, gives the composition of the teams of participants for the international olympiads.
The first line contains an integer (1 \leq n \leq 10^{4}) — the number of participants in the olympiad.
Each of the following lines contains information about the olympiad participants:
— the unique number of the participant (10^6 \leq id < 10^7);
— the gender of the participant (male — male, female — female);
— the grade level of the participant (1 \leq grade \leq 11);
— the age of the participant (10 \leq age \leq 20);
— the number of points scored by the participant across all selection rounds (0 \leq score \leq 10^8).
It is guaranteed that all 's and 's of the participants are distinct.
The next line contains an integer (1 \leq m \leq 7) — the number of international olympiads for which Miss M wants to know the composition of the teams of participants.
The next lines contain the names of the international olympiads for which the composition of the teams of participants must be output. Possible olympiads: IOI, CEOI, EGOI, EJOI, BaltOI, BalkOI, JBOI. It is guaranteed that all olympiads are distinct.
Output lines, which contain the names of the international olympiads, in the same order as specified in the input data, and the 's of the participants who are included in the teams, in the format of increasing order of the participant's number.
Example
All participants can take part in IOI, the results table will look as follows:
— points
— points
— points
— points
— points
— points
— points
— points
— points
— points
The olympiad team consists of , , , .
Only girls can take part in EGOI, the results table will look as follows:
— points
— points
— points
The olympiad team consists of , , .
All participants can take part in BaltOI, the results table will look the same as for IOI. The same participants will make it into the team as for IOI, but also and .
In this problem there are tests in which m=1 for each possible olympiad. That is, if you can solve the problem only for a certain olympiad, you are guaranteed to receive points.