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.

EIGPA3 - Scholarship

CIT have at most m scholarships for their students. They will choose best students with highest GPA in the school year. Note that students can take a course multiple time. The result of the last time a student takes a course will be his/her result for that course. Student’s GPA is calculated based on courses that he/she got at least 50. Given the result of students in order of increasing time, find out the list of students who will achieve the scholarship.

Input

The first line contains two integers n and m.  (m ≤ n ≤ 105).

Each line in the next n lines contains student’s identity, course’s code and overall score. Student’ identity is a string contains at most 10 digits. Course’s code is an integer have at most 9 digits and overall score is between 0 and 100 (inclusive).

Output

The list of students received the scholarships in the order of decreasing GPA. Each student includes the student’s identity and GPA (rounded to whole integer). Note that if two students have same GPA (not rounded), they will get scholarships together or none of them get scholarships.

Sample

Input

Output

7 2

1 1 10

1 2 50

1 1 55

1 2 45

2 1 55

3 1 100

3 2 80

3 90

 


Added by:Ha Minh Ngoc
Date:2019-12-16
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: GOSU
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.