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:
def comp(st):
	l = len(st)
	new = st[0]
	for i in range(1,l):
		ch = st[i]
		if ch!=new[-1]:
			new = new + ch
	return len(new)
for i in range(input()):
	st = raw_input()
	val = comp(st)
	d = {}
	for item in st:
		try:
			d[item] += 1
		except:
			d[item] = 1
	if len(d)>=4:
		print "YES"
	elif len(d)==1:
		if len(st)>=10:
			print "YES"
		else:
			print "NO"
	elif len(d)==3:
		if len(st)>=6:
			print "YES"
			continue
		if val>=5:
			print "YES"
		elif val==4:
			if len(st)>=5:
				print "YES"
			else:
				print "NO"
		elif val==3:
			ff = False
			for item in d:
				if d[item]>=3:
					ff = True
			if ff:
				print "YES"
			else:
				print "NO"
	else:
		if len(st)>=7:
			print "YES"
			continue
		if len(st)<=5:
			print "NO"
			continue
		print "NO"