Coin Turning Game

No attempts yetTime limit2sMemory limit256 MB

Problem

Alice and Bob play a coin game. Alice moves first.

NN coins lie in a row, each showing heads or tails. On a turn a player picks a block of consecutive coins and flips every coin in that block. The rightmost coin of the block must show heads before the flip, so it goes from heads to tails. A player who cannot pick such a block loses.

The initial arrangement of the coins is given. Decide whether Alice wins when both players play optimally.

Input

The first line contains an integer TT (1T1001 \le T \le 100), the number of test cases.

Each of the next TT lines contains a string SS (3S153 \le |S| \le 15). Every character of SS is H or T, where H means the coin shows heads and T means it shows tails.

Output

Print one line for each test case.

If Alice wins, print YES p k. Here pp is the position of the rightmost coin she flips on her first move, counting from 1, and kk is the number of coins that move flips. When several first moves win, choose the one with the smallest pp, and among those the one with the smallest kk.

If Alice cannot win, print NO.