P19134 [HackerEarth] A tournament is going on in the Society Park. One of the game people are playing is Rock Paper Scissors. We all know Rock Paper Scissors game, but for a reminder, the rules are:
普及
题目描述

A tournament is going on in the Society Park. One of the game people are playing is Rock Paper Scissors. We all know Rock Paper Scissors game, but for a reminder, the rules are:
Paper always wins against Rock.
Rock always wins against Scissors.
Scissors always win against Paper.

Now the rules for scorecard:
For every game won, the player is awarded one point.
For every game tied, the player is awarded half of a point.
For every game lost, the player is awarded zero points.

Only a single player will win, namely the player with the most points. If several players have the same amount of points, the player which comes first in the input wins.

All players observe a simple strategy: each of them prepares a sequence of throws and plays the same sequence in every game. Character 'P' represents a Paper throw, 'S' represents a Scissors throw, and 'R' represents a Rock throw.

INPUT

First line of input gives T, the number of test cases.
T test cases follow, first line of each test case gives N the number of players.
Since the number of turns in game is fixed to 5, each string will be of length 5.

OUTPUT

Give the zero-based index of player who wins the game.

CONSTRAINTS
players will contain between 1 and 50 elements, inclusive.
Each element of players will contain exactly 5 characters.
Each element of players will contain only the characters 'P', 'R' and
'S'.
1 ≤ T ≤ 50

SAMPLE INPUT
1
4
PPRRS
PPRRP
PPRSP
PPSSP

SAMPLE OUTPUT
0

Explanation

Player 0 will defeat players 1, 2 and 3 with 1, 2 and 3 throws won respectively so he gets 3 points.

Player 1 will defeat players 2 and 3 with 1 and 2 throws won respectively so he gets 2 points.

Player 2 defeats player 3 with 1 throw won so gets 1 point.

Player 3 does not win a single game so he gets 0 points.

The winner is player 0 with 3 points.
Another example for clarification of problem statement:
4
RRRRR
PPPPP
SSSSS
PPPPP

OUTPUT: 2

Player 2 defeats players 1 and 3 and loses to player 0 and has 2 points in total.

Players 1 and 3 defeat player 0 and tie each other ending with 1.5 points.

Player 0 defeats player 2 for 1 point in total.

输入格式

见题面

输出格式

见题面

样例输入
2 4 RRRRR PPPPP RRRRR PPPPP 4 RRRRR PPPPP SSSSS PPPPP
样例输出
33