Teacher Troubles

View as PDF

Submit solution

Points: 5 (partial)
Time limit: 1.0s
Memory limit: 64M

Author:
Problem type

Mr. Ye is a teacher at his local school and he is particularly bad with names.

He can hardly remember the names of his students even after spending three months with them. Specifically, he gets very bad headaches whenever there are two or more students with the same name in his class, since he would never be able to remember who's who.

It's nearing the start of another school year, and the school had just emailed him the list of emails of the N (1 \le N \le 10^5) students who will be joining his class this year. He wants to figure out if he will suffer any headaches this year, but he can't go through all the emails all by himself, since Mr. Ye is a very popular teacher at the school and gets many students in his class ever year, which is why he has asked you, his favorite student, to write a program for him to determine if he will have to undergo headaches this year or not.

Constraints

Subtask 1 [20%]

N \le 1000

Subtask 2 [80%]

No additional constraints.

Input Specification

The first line of input will contain one integer N.

The next N lines will each contain the email address of the ith student.

Each email address will be in the format (first name).(last name)(number)@student.tdsb.on.ca

Example: john.doe32@student.tdsb.on.ca

It is guaranteed that both the first name and last name will only contain lowercase letters.

It is guaranteed that each email address is distinct, and that each address will not be more than 100 characters in length.

Output Specification

If there are students with the same first name and same last name, output BIG HEADACHE

If the above is false, but there are students with the same first name but have different last names, output HEADACHE

If both of the above are false, output NO HEADACHE

Sample Input 1

4
john.james3@student.tdsb.on.ca
john.mackenzie12@student.tdsb.on.ca
william.mackenzie2@student.tdsb.on.ca
chris.william5@student.tdsb.on.ca

Sample Output 1

HEADACHE

Sample Input 2

3
ethan.zhu3@student.tdsb.on.ca
ethan.liu12@student.tdsb.on.ca
ethan.zhu10@student.tdsb.on.ca

Sample Output 2

BIG HEADACHE

Comments

There are no comments at the moment.