COUPLING : The act of linking together or forming couples.
Couples have to be formed from a throng(crowd). In a couple(male female only),the male partner
should be taller than the female partner.

You are given a sorted list of all people according to their heights (such that shortest in the list is the first). The elements in the list are F &/or M depicting female or male .

Now its yur duty to tell whether its possible that everyone forms a couple with the requirement stated above.

Input

1st line: An Integer T denoting the number of test cases.

Each test Case Contains: A single line representing the list consists of only 'F '& / or 'M'.

Output

T lines each containing 'YES' (if possible that everyone forms a couple ) or 'NO' (if not possible).

Sample Input

``` 3 FFMM MMMMMM FMFMFMF ```

Sample Output

``` YES NO NO ```

Constraints

Number of Test Cases T , 1 < T <= 20

1 < Length(list) <= 10,000

Problem Setter : Vivek Bhatnagar

Languages: C,C++,Java

Time Limit: 2 Second(s)
Score: 100 Point(s)
Input File Limit: 50000 Bytes

Mode Judge

RankNameScore
1xyz0
2Ams0
3TIP0
4team420
5xyzz0
6asdasdasd0
7abcd0
8khankhan0
9Gabriel0
10gigel0