Problem hidden
This problem was hidden by Editorial Board member probably because it has incorrect language version or invalid test data, or description of the problem is not clear.

EISCH2 - Scholarship 2

Each student is considered for a scholarship at the end of the academic year. There are three types of scholarships A, B and C. Know that:

  • Students who receive A scholarship must be in the group of 1/12 students with the highest GPA.
  • Students who receive B scholarships must be in the group of 1/3 students with the highest GPA and not receive scholarship A.
  • Students who receive C scholarships must be in the 1/2 group of students with the highest scores and not receiving scholarships A and B.
  • Students with the same GPA (not rounded off) will receive or not receive the same scholarship and the number of students who receive the scholarship will not exceed the specified rate.

Compute the list of students with corresponding scholarships in descending order of scores and in ascending names.

Input

The first line contains the number of students (denoted by n) (n ≤ 105).

In the next n lines, each line represents a student, including:

  • Student name (including lowercase characters and no more than 20 characters)
  • p number of student's subjects (1 ≤ p ≤ 30)
  • p integers which are the student's subject score. Guaranteed score greater than or equal to 50

Output

List of students, including student name, GPA and scholarship type,  in order of decreasing average scores and increasing names (in alphabetical order). average scores are rounded to two decimal places

Example

Input:
14 
nam 1 56
an 1 56
ngoc 1 60
duc 1 58
khanh 1 53
vu 1 69
linh 1 50
tien 1 65
toan 2 65 64
tu 1 60
trang 1 55
son 1 55
canh 1 50
lam 1 55


Output:
vu 69 A
tien 65  B
toan 64.5 B
ngoc 60 C
tu 60 C
duc 58 C


Added by:Ha Minh Ngoc
Date:2018-12-06
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:CSHARP C++ 4.3.2 CPP CPP14 CPP14-CLANG FSHARP GO JAVA JS-MONKEY NODEJS PHP PYTHON PYPY PYPY3 PYTHON3 RUBY SQLITE SWIFT VB.NET
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.