Sad Splits

 You are given a positive integer 

. You have to split each digit of into either of two non-empty subsequences or

.

For example, if

, some possible values of can be and . Note that, after separating the digits into and

, these subsequences are considered as positive integers and thus leading zeros can be omitted.

Let us define a function

. Find out whether it is possible to find two non-empty subsequences and formed out of such that

.

Input Format

  • First line will contain
  • , number of test cases. Then the test cases follow.
  • Each test case contains of a single line of input, one integer
    • .

    Output Format

    For each test case, print

    if it is possible to find two non-empty subsequences and formed out of such that . Otherwise, print

    .

    You may print each character of the string in uppercase or lowercase (for example, the strings

    , , and

    will all be treated as identical).

    Constraints

    Subtasks

    • Subtask 1 (100 points): Original constraints.

    Sample Input 1

    2
    10
    73452
    

    Sample Output 1

    NO
    YES
    

    Explanation

    Test Case

    : The only two possibilities are:

    : Here
  • .
  • : Here . Hence it's not possible to achieve
    • .

    Test Case

    : One of the possible ways to split the digits of such that

    is:

    : Here
    Previous
    Next Post »