Who Advanced?
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output

Many residents of Bitaculandia participate in the stages of international programming olympiads. There are seven such olympiads held in Bitaculandia:

1. IOI - International Olympiad in Informatics
2. CEOI - Central-Eventora Olympiad in Informatics
3. EGOI - Eventora Girls Olympiad in Informatics
4. EJOI - Eventora Junior Olympiad in Informatics
5. BaltOI - Balticodian Olympiad in Informatics
6. BalkOI - Balkolian Olympiad in Informatics
7. JBOI - Junior Balkolian Olympiad in Informatics

Miss M is responsible for organizing various stages of olympiads, as well as selections (training camps) for all seven international stages. After the last selection round, teams of four to six people are formed for all seven olympiads. However, only those participants who meet the criteria for participation in the olympiad should be sent to each competition. Here is a list of algorithms for determining the participants of the teams for the olympiads:

1. IOI - Top $$$4$$$ participants based on the total scores from all selection rounds.
2. CEOI - Top $$$4$$$ participants based on the total scores from all selection rounds.
3. EGOI - Top $$$4$$$ female participants based on the total scores from all selection rounds.
4. EJOI - Top $$$4$$$ participants at most $$$15$$$ years old based on the total scores from all selection rounds.
5. BaltOI - Top $$$6$$$ participants based on the total scores from all selection rounds.
6. BalkOI - Top $$$4$$$ participants who are not in $$$11$$$th grade based on the total scores from all selection rounds.
7. JBOI - Top $$$4$$$ participants who are not in $$$11$$$th or $$$10$$$th grade based on the total scores from all selection rounds.

If there are fewer participants than the required number, it means that the team will consist of fewer people. For example, if you need to determine the team for EGOI and there are only two girls, it means that the team will consist of only two participants, not four.

Since there are many participants and many olympiads, and the results are desired immediately after the competition ends, Miss M asks to write a program that, based on the results and information about the participants, provides the composition of the teams for the international stages of the olympiads.

Input

The first line contains an integer $$$n$$$ ($$$1 \leq n \leq 10^{4}$$$) — the number of olympiad participants.

Each of the following $$$n$$$ lines contains information about the olympiad participants:

- $$$id$$$ — unique participant number ($$$10^6 \leq id < 10^7$$$);
- $$$gender$$$ — participant's gender (male — male, female — female);
- $$$grade$$$ — participant's grade level ($$$1 \leq grade \leq 11$$$);
- $$$age$$$ — participant's age ($$$10 \leq age \leq 20$$$);
- $$$score$$$ — the number of points participants have from all selection rounds ($$$0 \leq score \leq 10^8$$$).

It is guaranteed that all $$$id$$$ and $$$score$$$ of participants are different.

The next line contains an integer $$$m$$$ ($$$1 \leq m \leq 7$$$) — the number of international olympiads for which Miss M wants to know the composition of the participant teams.

The following $$$m$$$ lines contain the names of the international olympiads for which the composition of the participant teams needs to be output. Possible olympiads: IOI, CEOI, EGOI, EJOI, BaltOI, BalkOI, JBOI. It is guaranteed that all olympiads are different.

Output

Output $$$m$$$ lines, containing the names of the international olympiads, in the same order as specified in the input data, and the $$$id$$$ of participants who are part of the teams, in the format of increasing participant $$$id$$$ number.

Scoring

In this problem, there are tests where $$$m=1$$$ for each possible olympiad. That is, if you can only solve the problem for a certain olympiad, you are guaranteed to receive points.

Example

Input

    101000001 female 10 16 4001000002 male 10 17 5001000003 male 11 17 5051000004 male 11 16 4051000005 female 11 17 4501000006 female 10 15 4801000007 male 9 15 4451000008 male 6 12 3501000009 male 8 13 3991000010 male 10 16 4303IOIEGOIBaltOI

Output

    IOI
    1000002
    1000003
    1000005
    1000006

    EGOI
    1000001
    1000005
    1000006

    BaltOI
    1000002
    1000003
    1000005
    1000006
    1000007
    1000010

Note

All participants can take part in IOI, the results table will look like this:

1. $$$1000003$$$ — $$$505$$$ points
2. $$$1000002$$$ — $$$500$$$ points
3. $$$1000006$$$ — $$$480$$$ points
4. $$$1000005$$$ — $$$450$$$ points
5. $$$1000007$$$ — $$$445$$$ points
6. $$$1000010$$$ — $$$430$$$ points
7. $$$1000004$$$ — $$$405$$$ points
8. $$$1000001$$$ — $$$400$$$ points
9. $$$1000009$$$ — $$$399$$$ points
10. $$$1000008$$$ — $$$350$$$ points

The participants who will go to the olympiad are $$$1000003$$$, $$$1000002$$$, $$$1000006$$$, $$$1000005$$$.

Only girls can participate in EGOI, the results table will look like this:

1. $$$1000006$$$ — $$$480$$$ points
2. $$$1000005$$$ — $$$450$$$ points
3. $$$1000001$$$ — $$$400$$$ points

The participants who will go to the olympiad are $$$1000006$$$, $$$1000005$$$, $$$1000001$$$.

All participants can take part in BaltOI, the results table will look the same as for IOI. The same participants who will go to IOI will also go to BaltOI, as well as $$$1000007$$$ and $$$1000010$$$.