A form guide is a sport statistic that shows how well a team has been playing lately. It usually lists the results of the last n matches as a string of win, draw and loss marks.
Each result line starts with H for a home match or A for an away match. After that first character come two scores joined by a hyphen. In a home result Hx-y, the first number x is our team's score and the second number y is the opponent's score. In an away result Ay-x the order is reversed, so the first number y is the opponent's score and the second number x is our team's score. Our team's score is the first number at home and the second number away.
A match is a win (W) when our team scored more, a draw (D) when both scores are equal, and a loss (L) when our team scored less.
The results are given oldest first. Build the form string over all matches, over home matches only and over away matches only, then find the longest run of consecutive wins, the longest run of consecutive draws and the longest run of consecutive losses in the overall form.
The first line contains the number of matches n (1≤n≤100). Each of the next n lines holds one result, oldest first. A line starts with H for a home match or A for an away match, followed by two scores joined by a hyphen: Hx-y for a home match and Ay-x for an away match, where x is our team's score and y is the opponent's score. Every score is a nonnegative integer.
Print six lines.
Print an empty line when no match belongs to that group, and print 0 when the run in question never occurs.