ACM Eastern European Regional Programming Contest.
Bucharest, Romania
October 19, 1996

Problem F
HEAD JUDGE HEADACHE

Input File Name: F.DAT

Program Source File: F.PAS or F.C or F.CPP


You are the Head Judge of the ACM Eastern European Regional Programming Contest. The master Judge computer has been infected by computer virus which has formated the hard disk. You have only the listing of submitted problems log formatted as follows:

Team No (Max 25)

Problem Letter (A..G)

Time of submittion Hours:minutes

Status of the run Y/N


Write a program to compute the final standing by using the following rules:

Teams are ranked according to the most problems solved. Teams who have solved the same number of problems are ranked by least total time. The total time is the sum of the time consumed for each problem solved. The time consumed for a solved problem is the time ellapsed from the beginning of the contest to the submital of the accepted run plus 20 minutes for each rejected run. There is no time consumed for a problem that is not solved. Teams with equal score are assigned equal rank sorted by team number.


Example:


INPUT:

1 A 0:50 N
3 A 1:12 Y
2B1:19N1A1:20Y2B1:35N1B1:36N3B1:40Y3C1:41N4A1:40Y

OUTPUT:RANKTEAMPRO/SOLVEDTIME13217221110024110042