Problem: 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

Solution (in PYTHON):

Solution:
t=input()

while(t>0):
    s=raw_input();
    flag1=0
    flag2=0
    flag3=0
    for split1 in range(1,len(s)-2):
        for split2 in range(2,len(s)-1):
            for split3 in range(3,len(s)):
                s1=s[:split1]
                s2=s[split1:split2]
                s3=s[split2:split3]
                s4=s[split3:]
                if len(s1)!=0 and len(s2)!=0 and len(s3)!=0 and len(s4)!=0 :
                    if s1!=s2 and s1!=s3 and s1!=s4 and s2!=s3 and s2!=s4 and s3!=s4:
                        flag3=1
                        break
            if flag3==1 :
                flag2=1
                break
        if flag2==1 :
            flag1=1
            break
    if flag1==1 :
        print ("YES")
    else:
        print ("NO")  
    t-=1