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 = int(raw_input())
for i in range(0, t):
	flag=0
	start = 0
	end = 1
	str_set = set()
	str = raw_input()
	while( start < len(str) and end <= len(str) ):
		if str[start:end] in str_set:
			end+=1
		else:
			str_set.add(str[start:end])
			start=end
			end=start+1
		if len(str_set) > 3:
			print "YES"
			flag=1
			break
		
	#for handling cases like aaoaaaaa
	if flag == 0 and len(str)>1 and str[0] == str[1]:
		str_set = set()
		str_set.add(str[0:2])
		start = 2
		end = 3
		while( start < len(str) and end <= len(str) ):
			if str[start:end] in str_set:
				end+=1
			else:
				str_set.add(str[start:end])
				start=end
				end=start+1
			if len(str_set) > 3:
				print "YES"
				flag=1
				break
		
	#for handling cases like aaaaaoa
	if flag == 0:
		str = str[::-1] 
		start = 0
		end = 1
		str_set = set()
		while( start < len(str) and end <= len(str) ):
			if str[start:end] in str_set:
				end+=1
			else:
				str_set.add(str[start:end])
				start=end
				end=start+1
			if len(str_set) > 3:
				flag=1
				print "YES"
				break
	
	if flag == 0:
		print "NO"