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:
'''
# Read input from stdin and provide input before running code

name = raw_input('What is your name?\n')
print 'Hi, %s.' % name
'''

def get_ans(string):
	
	if len(string) < 4:
		return "NO"
	
	if len(string) >= 10:
		return "YES"
		
	if len(string) == 4:
		for i in range(len(string)):
			if string.count(string[i]) != 1 :
				return "NO"
		return "YES"
		
	else:

		# if len(g) >= 4 or len(ng) >= 4:
		# 	return "YES"
		# else:
		dd = dict((x, string.count(x)) for x in string)
		if len(dd) == 4:
			return "YES" 
		elif len(dd) == 2 and len(string) < 7:
			return "NO"

		ln = len(string)
		if ln % 2 == 0:
			if string[:ln/2] != string[ln/2:]:
				return "YES"
			else:
				return "NO"

		else:
			if string[:ln/2] != string[ln/2+1:]:
				return "YES"
			else:
				if string[ln/2] not in string[:ln/2] and len(string[:ln/2]) != 2:
					return "YES"
				else:
					return "NO"
'''
		if string[0] != string[1] and string[0] != string[2] and string[1] != string[2]:
			return "YES"

		if string[-1] != string[-2] and string[-1] != string[-3] and string[-2] != string[-3]:
			return "YES"

		dd = dict((x, string.count(x)) for x in string)
		if len(dd) == 4:
			return "YES" 
		elif len(dd) == 2 and len(string) < 7:
			return ""

		g = [] 
		ng = []
		ns = ''
		s = ''
		for i in range(len(string)):
			s += string[i]
			ns += string[len(string)-i-1]
			if s not in g:
				g.append(s)
				s = ''
				
			if ns not in ng:
				ng.append(ns)
				ns = ''
				
		if len(g) >= 4 or len(ng) >= 4:
			return "YES"
		else:
			if len(string) % 2 == 0:

			else:
'''
					
'''
f = open("ipp.txt","r")

lns = f.readlines()

for i in range(1,len(lns)):
	lns[i] = lns[i][:len(lns[i])-1]
	print lns[i][:11],len(lns[i]),get_ans(lns[i])
	# s = raw_input()

exit()
'''
n = int(raw_input())

for i in range(n):
	print get_ans(raw_input())
# '''