Kevin has a string S consisting of N lowercase English letters.  

Kevin wants to split it into 4 pairwise different non-empty parts.  For example, string "happynewyear" can be splitted into "happy", "new", "ye" and "ar". He can't delete any characters or change the order of the characters.

Help Kevin and find if there exist at least one possible spliting.

Input format:

The first line of input will contain an integer T, denoting the number of test cases. Each of the next T lines contains a string S.

Output format:

For every test case output "YES" if it is possible to split the string and "NO" otherwise.

Constraints:
1 ≤ T ≤ 100
1 ≤ N ≤ 1000
N ≤ 20 in test data worth 40% of all points

SAMPLE INPUT
2
ababca
aaabb

SAMPLE OUTPUT
YES
NO
'''
# Read input from stdin and provide input before running code

name = raw_input('What is your name?\n')
print 'Hi, %s.' % name
'''
yes = "YES"
no = "NO"

def perform_test():

    s = str(raw_input())
    if len(s) >= 10:
        print yes
        return
    if len(s) <= 3:
        print no
        return

    for s1 in range(len(s)-3):
        for s2 in range(s1+1, len(s)-2):
            for s3 in range(s2+1, len(s)-1):
                for s4 in range(s3+1, len(s)):
                    st1 = s[s1:s2]
                    st2 = s[s2:s3]
                    st3 = s[s3:s4]
                    st4 = s[s4:]
                    if ( st1!=st2 and st2!=st3 and st3!=st4 and st4!=st1 and
                                 st1!=st3 and st2!=st4):
                        print yes
                        return

    print no




test_cases = int(raw_input())

for i in range(test_cases):
    perform_test()