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
'''
t = raw_input();

for o in range(0,int(t)):
	s = raw_input();
	
	if len(s) > 10:
		print "YES"
	elif len(s) < 4:
		print "NO"
	else:
		fl = 0;
		for i in range(0,len(s)-3):
			for j in range(i,len(s)-2):
				for k in range(j,len(s)-1):
					for p in range(k,len(s)):
						lst = []
						str1 = s[i:j]
						str2 = s[j:k]
						str3 = s[k:p]
						str4 = s[p:]
						if str1 != "":
							lst.append(str1)
						if str2 != "" and str2 not in lst:
							lst.append(str2)
						if str3 != "" and str3 not in lst:
							lst.append(str3)
						if str4 != "" and str4 not in lst:
							lst.append(str4)
						
						if len(lst) == 4:
							fl = 1
							break;
					
					if fl == 1:
						break
				if fl == 1:
					break
			if fl == 1:
				break
		
		if fl == 1:
			print "YES"
		else:
			print "NO"