Every year students around the world enter the ACM ICPC. To enter the contest, a student must be eligible to compete. Given information about students, write a program that decides whether each student is eligible.
Assume every student already meets the basic requirements in the ICPC rules: the student is willing to compete at the World Finals, is a registered student with at least a half-time load, competes for only one institution in a contest year, and has not competed in two World Finals or five regional contests.
The rules that decide whether a student may compete in the contest year 2014 to 2015 are these.
One semester of full-time study counts as 5 completed courses. A student who has completed 41 courses or more therefore counts as having more than 8 semesters of full-time study.
The input consists of a number of cases. The first line contains a positive integer, the number of cases that follow. Each case is given on one line in this format.
name YYYY/MM/DD YYYY/MM/DD courses
name is the name of the student and has up to 30 alphabetic characters. The first date is the date the student first began post-secondary studies, and the second date is the student's date of birth. Every date uses the format above, with a 4-digit year, a 2-digit month, and a 2-digit day. courses is a non-negative integer, the number of courses the student has completed.
There are at most 1000 cases.
For each student, print the student's name, a space, and then one of the strings eligible, ineligible, and coach petitions, whichever applies.