There are N teams taking part in The Programming Olympic Games. They are numbered by integers between 0 and N-1, inclusive. According to the rules, the Games consist of many competitions. The three top scoring teams within each competition are awarded gold, silver and bronze medals. Within a single competition, there can be no ties, and a single team can win at most one medal. After the Games are over, the following rules are used to rank the teams:
- If two teams each have a different number of gold medals, the team with more gold medals is ranked higher. Otherwise, the next rule is used.
- If two teams each have a different number of silver medals, the team with more silver medals is ranked higher. Otherwise, the next rule is used.
- If two teams each have a different number of bronze medals, the team with more bronze medals is ranked higher. Otherwise, the lower numbered team is ranked higher.
The Games are now in progress and left competitions are left before the Games are over. You are given a String medals, the i-th element of which represents the current number of medals won by the i-th team. Each element is formatted "GOLD SILVER BRONZE" (quotes for clarity), where GOLD is the number of gold medals, SILVER is the number of silver medals, and BRONZE is the number of bronze medals.
Team 0 is very strong in the disciplines represented by all of the remaining competitions. Therefore, they will definitely win gold medals in all of them. Return the worst possible final ranking for team 0, where 1 is the highest ranking, 2 is the second highest, and so on.