"No sports, no Tsinghua." To better encourage students to engage in physical exercise and evaluate them more scientifically, the teachers at the Wudaokou Sports School have put a great deal of effort into the assessment of physical education grades. However, at the end of each semester, dealing with massive amounts of raw data to calculate students' final physical education grades becomes a major challenge for the teachers in the Physical Education Department.
For freshmen, the final physical education grade consists of five parts: the physical education course grade (maximum $50$ points), the long-distance running test grade (maximum $20$ points), the "Sunshine Long-Distance Running" grade (maximum $10$ points), the physical fitness test grade (maximum $10$ points), and the "Freshman Special Plan" grade (maximum $10$ points).
The physical education course grade is given directly by the physical education instructor.
The long-distance running test grade is determined by the final long-distance running test. Male students must complete a $3000$-meter test, and female students must complete a $1500$-meter test. The specific scoring criteria are as follows:
| $20$ | $18$ | $16$ | $14$ | $12$ | $10$ | $8$ | $6$ | $4$ | $2$ | |
|---|---|---|---|---|---|---|---|---|---|---|
| Male | $12'30''$ | $13'00''$ | $13'30''$ | $14'00''$ | $14'30''$ | $15'10''$ | $15'50''$ | $16'30''$ | $17'10''$ | $18'00''$ |
| Female | $6'40''$ | $6'57''$ | $7'14''$ | $7'31''$ | $7'50''$ | $8'05''$ | $8'20''$ | $8'35''$ | $8'50''$ | $9'00''$ |
"Sunshine Long-Distance Running" uses a mobile app to record students' extracurricular running. The grade for this part is determined by filtering the raw running data to obtain the number of valid extracurricular runs.
A valid exercise record must satisfy all of the following conditions:
- The running distance is at least $3000$ meters for males and at least $1500$ meters for females (inclusive).
- The average speed (distance / (end time - start time)) is no slower than $2$ m/s and no faster than $5$ m/s.
- The total pause time does not exceed $4$ minutes and $30$ seconds.
- The average stride length (distance / number of steps) does not exceed $1.5$ meters.
- The start time must be at least $6$ hours after the end time of the previous valid record (inclusive).
The correspondence between the number of valid "Sunshine Long-Distance Running" records and the score for this part is as follows:
| Score | $10$ | $9$ | $8$ | $7$ | $6$ | $4$ | $2$ |
|---|---|---|---|---|---|---|---|
| Count | $[21,+\infty)$ | $[19,20]$ | $[17,18]$ | $[14,16]$ | $[11,13]$ | $[7,10]$ | $[3,6]$ |
For the physical fitness test, if the passing standard is met, the student receives the full $10$ points; otherwise, they receive $0$ points for this part.
The $10$ points for the "Freshman Special Plan" consist of two parts: attendance counts for $5$ points, and the final test counts for $5$ points.
The attendance count is the sum of the number of times the student participated in "Class Training Camps" and the number of valid "Sunshine Long-Distance Running" records. The correspondence between attendance score and attendance count is as follows:
| Score | $5$ | $4$ | $3$ | $2$ | $1$ |
|---|---|---|---|---|---|
| Count | $[18,+\infty)$ | $[15,17]$ | $[12,14]$ | $[9,11]$ | $[6,8]$ |
It is not difficult to see that calculating everyone's physical education grade accurately is not an easy task. Therefore, the teachers in the Physical Education Department have found you, who are currently participating in the school programming contest. They will provide all the necessary data and hope you can help them calculate the final physical education grades and letter grades for the Tsinghua freshmen.
The correspondence between the percentage grade, letter grade, and GPA is as follows:
| A | A- | B+ | B | B- | C+ | C | C- | D+ | D | F |
|---|---|---|---|---|---|---|---|---|---|---|
| $[95, 100]$ | $[90, 95)$ | $[85, 90)$ | $[80, 85)$ | $[77, 80)$ | $[73, 77)$ | $[70, 73)$ | $[67, 70)$ | $[63, 67)$ | $[60, 63)$ | $[0, 60)$ |
Input
Read data from standard input.
The first line of input contains a positive integer $n$, representing the number of freshmen.
The next $n$ lines each represent a student (given in lexicographical order of student ID). Data items are separated by spaces. A student's data includes:
- A $10$-digit positive integer $p$ (guaranteed not to contain leading zeros), representing the student's ID.
- A character,
MorF.Mindicates the student is male, andFindicates the student is female. - A non-negative integer $s$ between $0$ and $50$, representing the student's physical education course grade.
- A string in the format
a'b", representing the student's final long-distance running test time as $a$ minutes and $b$ seconds. - A character,
PorF.Pindicates the student passed the physical fitness test, andFindicates the student did not pass. - A non-negative integer $f$ between $0$ and $5$, representing the student's "Freshman Special Plan" final test grade.
- A non-negative integer $c$, representing the number of times the student participated in "Class Training Camps".
The next line contains a non-negative integer $m$, representing the number of "Sunshine Long-Distance Running" records to be filtered.
The next $m$ lines each represent a "Sunshine Long-Distance Running" record (given in chronological order of start time). Data items are separated by spaces. A record includes:
- A string in the format
2017MMDD, representing the completion date of the $j$-th record. - A $10$-digit positive integer $p$ (guaranteed not to contain leading zeros), representing the student ID associated with the $j$-th record.
- Two strings in the format
hh:mm:ss, representing the start time and end time of the $j$-th record, respectively. - A non-negative floating-point number $l$ with two decimal places, representing the distance of the $j$-th record in kilometers.
- A string in the format
a'b", representing the total pause time of the $j$-th record as $a$ minutes and $b$ seconds. - A non-negative integer $s$, representing the total number of steps for the $j$-th record.
Output
Output to standard output.
The output consists of $n$ lines. Output each student's ID, percentage grade, and letter grade in lexicographical order of student ID. Each student occupies one line, with items separated by spaces.
Examples
Input 1
1 2015011233 M 34 14'30" P 3 3 8 20170508 2015011233 17:02:33 17:19:33 2.99 0'0" 3333 20170509 2015011233 17:12:15 17:38:46 3.01 2'3" 4300 20170510 2015011233 22:03:06 22:13:08 3.05 0'0" 2772 20170511 2015011233 22:08:05 22:28:13 3.02 5'3" 3775 20170512 2015011233 18:03:12 18:17:56 3.02 0'0" 2001 20170513 2015011233 17:30:23 17:46:08 3.01 0'0" 3020 20170513 2015011233 22:03:34 22:20:08 3.04 2'0" 3058 20170514 2015011233 07:16:22 07:32:34 3.00 0'0" 3244
Output 1
2015011233 59 F
Subtasks
For $100\%$ of the data: $n \leq 4000,$ $0 \leq a, b \leq 59,$ $0 \leq c \leq 100,$ $m \leq 1.5 \times 10^5,$ $0 \leq l \leq 100,$ $0 \leq s \leq 10^6.$