Hide

Problem K
Eiginnöfn

Languages en is
/problems/eiginnofn/file/statement/en/img-0001.jpg
Image from flickr.com

Most Icelanders have either one or two given names. Those that have two given names are usually addressed only with their former given name, but not the latter. The parents of those people sometimes react quite harshly when this happens. When Arnar’s parents were asked whether Arnar was home, the answer was rarely a simple yes or no. Instead they answered: “No, but Arnar Bjarni is home.”

A smart doorbell has been set up at the house, in which guests can input the name of the person which they are visiting. There are some concerns that this is a solution that loses the personal touch and there is an unwillingness to lose the charm which people experience from jokes made by parents. Therefore the doorbell stores the name of each resident, but in the visitor interface the user can only input a single given name to ask for a resident. The doorbell then responds whether the resident is home, as Arnar’s parents did. If the resident has one given name and is home, the doorbell responds with a yes. If the resident has two given names and is home, the doorbell responds with a no, but additionally corrects the person and claims a person with both given names of the resident is home. If the resident is not home, the doorbell answer with a no.

Input

Input starts with a line consisting of a single integer $n$, the number of residents which are home. Then $n$ lines follow, where each line consists of either one or two given names, which are separated by a space.

Then follows a line with a single integer $m$, the number of queries made to the doorbell. Finally, $m$ lines follow, where each line consists of one given name, meaning the resident with that name is the one asked for.

You may assume that no two residents share the same former given name. Each given name starts with a capital letter and then small letters follow. Each letter in the given names is in the English alphabet. Given names are at most $10$ letters long.

Output

Each query shall be answered in the following way, in the same order as they appear in the input. If the resident is not home, you should output Neibb. If the resident is home and has no latter given name, you should output Jebb. If the resident is home and has a latter given name, you should output in the form of Neibb en <both given names> er heima.

Scoring

Group

Points

Constraints

1

10

Each resident has one given name and $1 \leq n, m, \leq 100$

2

10

Each resident has two given names and $1 \leq n, m \leq 100$

3

20

$1 \leq n, m \leq 100$

4

20

Each resident has one given name and $1 \leq n, m, \leq 10^5$

5

20

Each resident has two given names and $1 \leq n, m \leq 10^5$

6

20

$1 \leq n, m \leq 10^5$

Sample Input 1 Sample Output 1
6
Atli
Hannes
Arnar
Bjarki
Unnar
Konrad
6
Joi
Bjarki
Agust
Freyr
Unnar
Atli
Neibb
Jebb
Neibb
Neibb
Jebb
Jebb
Sample Input 2 Sample Output 2
6
Atli Fannar
Hannes Kristjan
Arnar Bjarni
Bjarki Agust
Unnar Freyr
Konrad Eli
5
Eli
Bjarki
Agust
Unnar
Atli
Neibb
Neibb en Bjarki Agust er heima
Neibb
Neibb en Unnar Freyr er heima
Neibb en Atli Fannar er heima
Sample Input 3 Sample Output 3
4
Arnar Bjarni
Gunnlaugur
Heidrun Groa
Orn
6
Arnar
Bjarni
Gunnlaugur
Heidrun
Sofia
Orn
Neibb en Arnar Bjarni er heima
Neibb
Jebb
Neibb en Heidrun Groa er heima
Neibb
Jebb