def check(string):
	for j in range(len(string)):
		for i in range(1,len(string)+1):
			if string[j:i]==string[-i:len(string)-j][::-1]:
				continue
			else:
				return False
	return True
n=input()
while n>0:
	string=raw_input()
	if check(string):
		print "YES"
	else:
		print "NO"
	n=n-1