Problem Description
21 point,also named Black Jack, originated in France,has spread around the world.

21 point, a gambling game played by using poker,is also the only one which is able to win banker by using probability calculation.

--- Encyclopedia from good search

We define blackjack rules are as follows, which is different from the original rules slightly.

cards are as follows:

A 2 3 4 5 6 7 8 9 10 J Q K

A is as 1 point.

JQK are all as 10 points.

We assume that the casino prepared a lot of cards,that is, you can assume that the probability of getting each card is the same.

There are two players who were banker and Player.

They get two cards at first and can see the card each other.

Player operates first.

Every turn, he can bid or stop bidding.

If he bid, he can take a card from the deck.

Once the the points are over 21,he will lose at once,which is called "busting", otherwise he will bid until stopping bidding and turn to banker.

the rule of banker is the same as the player's.

If there is no "busting", the one who have higher points win.

If they have the same points,they get the tie.

Here is the task,we give you the cards that both people have gotten.

please judge whether the Player have more than 50% winning percentage,
if yes, output "YES", otherwise output,"NO".

Oh, yes, everyone is very smart.

Input
The first line of the input file contains an integer Test(Test<=100000), which indicates the number of test cases.

For each test case, there is a string with four characters. the first and the second char indicate the card of the player.and the others indicate the banker's.(we use ‘T’ instead of '10')

Output
For each case of data output "YES" or "NO", it indicates whether the Player have more than 50% winning percentage.

Sample Input
1
TTT9

Sample Output
YES
//it's clear that player will not bid, then the blanker has only 2/13 winning percentage.

1个回答