ENG  RUSTimus Online Judge
Online Judge
Online contests
About Online Judge
Frequently asked questions
Site news
Problem set
Submit solution
Judge status
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests

1718. Rejudge

Time limit: 0.5 second
Memory limit: 64 MB
At three o’clock in the morning Sasha (aka Sandro) discovered that there were only seven tests for one of the problems in the first volume of the Timus Online Judge. “That won’t do,” Sasha thought and added ten new tests for that problem. At four o’clock in the morning, Vova (aka Vladimir Yakovlev) discovered that the sixth test in the same problem was incorrect. “That won’t do,” Vova thought and deleted the sixth test.
The next day Sasha and Vova came to work at two o’clock in the afternoon. After some discussion they decided to rejudge all the solutions for that problem that had been submitted before the moment Sasha added new tests.
After the rejudge each author receives an e-mail with the list of all her solutions for which the outcome has changed. If that list is empty the e-mail is not sent. Help Sasha and Vova determine the minimal possible and maximal possible number of authors who will receive an e-mail with the rejudge results.


The first line contains the number of solutions n that Sasha and Vova want to rejudge (1 ≤ n ≤ 1000). Each of the following n lines describes one solution and contains the name of its author and the previous outcome.
The name of the author is a nonempty string of length not exceeding 30. It may contain Latin letters, digits, the underscore character, parentheses and square brackets. It is guaranteed that no two different authors have names which differ only in case of the letters.
The possible outcomes are: AC, CE, ML X, TL X, and WA X, where X is an integer from 1 to 7. The outcome AC means that the solution passed all the tests. The outcome CE means that the solution failed to compile and, therefore, was not launched on any of the tests. The outcomes ML X, TL X, and WA X mean that the solution passed the tests with numbers less than X but failed to pass the test X because it exceeded the memory limit or the time limit or because it produced a wrong answer. The outcomes which differ only in test number are considered different.


Output the minimal possible and maximal possible number of authors who will receive e-mails with the rejudge results.


Milanin_(TNU) WA 6
Vladimir_Yakovlev_(USU) AC
Sandro_(USU) WA 1
Sandro_(USU) ML 3
0 3
Problem Author: Alexander Ipatov (prepared by Alex Samsonov)
Problem Source: NEERC 2009, Eastern subregional contest