Prime Time
Odd and Even have had their share of fun times playing the good old prime game:
They start with an arbitrary natural number, and take turns either adding 1 or dividing by a prime (assuming the result is still a natural number), and the one to reach 1 is the winner. However, now that they have a new friend, Ingmariay, they have decided to expand the rules of the game to allow for three-player action:
Instead of determining a winner for each round of play, they instead score points; the lowest number each of them has claimed during the round is the amount of points they get. (If any of them did not have the opportunity to claim any numbers, the starting number will be their score for that round.) At the end of the day, the player with the fewest points wins. And to avoid bad blood between themselves, they have all agreed that each of them only will focus on minimizing their own scores, and that whenever a player can choose dierent numbers that will result in the same score, that player will choose the lowest of those numbers. They have also agreed on a xed order of play: Odd → Even → Ingmariay → ..., but they alternate who gets to start.
You recently missed one of their exciting evenings of play, because you had to make problems for the NCPC event. Fortunately for you, they had recorded the numbers and starting players for each round, and told you that since they always play optimally, you could use this to simulate the event for yourself. Oh joy!
As an example round, assume that Even is chosen as the starting player, and with the starting number 15. Then Even claims 16, Ingmariay 8, Odd 4, Even 2 and Ingmariay 1. Odd gets 4 points, Even 2 and Ingmariay 1.
Input
The first line of input contains a single integer n (1 ≤ n ≤ 1000), the number of rounds they played that evening.
Then follow n lines each beginning with the rst character of the name of the starting player (either 'O', 'E' or 'I'), followed by a space and then the starting number for that round, in the range [1, 10000].
Note: If the starting number is 1, all players receive 0 point for that round.
Output
Output a single line with the score at the end of the day for each of the three contestants, in the order "Odd", "Even", "Ingmariay".