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:
import sys

fd = sys.stdin


def is_split_possible(inp_str):
	t=len(inp_str) # possible values 1,2,3,4,5,6
	max_val = t - 3
	combinations = max_val * max_val * max_val * max_val
	val1=1
	val2=1
	val3=1
	val4=1
	cnt = 0
	if len(inp_str) >= 10:
		return "YES"
	while val1 <= max_val:
		while val2 <= max_val:
			while val3 <= max_val:
				while val4 <= max_val:
					if (val1+val2+val3+val4)==t:
						first = 0
						second = val1
						third = second + val2
						fourth = third + val3
						fifth = fourth + val4
						seen =set()
						seen.add(inp_str[first:second])
						if inp_str[second:third] not in seen:
							seen.add(inp_str[second:third])
						if inp_str[third:fourth] not in seen:
							seen.add(inp_str[third:fourth])
						if inp_str[fourth:fifth] not in seen:
							seen.add(inp_str[fourth:fifth])
						if len(seen) == 4:
							return "YES"
						cnt += 1
					val4+=1
				val3 += 1
				val4 = 1
			val2 += 1
			val3 = 1
		val1 += 1
		val2 = 1
	return "NO"

input_list = []
for line in fd:
	input_list.append(line.strip("\n"))
n = input_list[0]
for i in input_list[1:]:
	print is_split_possible(i)