Every day, Mike goes to his job by a bus, where he buys a ticket. On the ticket, there is a letter-code that can be represented as a string of upper-case Latin letters.
Mike believes that the day will be successful in case exactly two different letters in the code alternate.  Otherwise, he believes that the day will be unlucky. Please see note section for formal definition of alternating code.
You are given a ticket code. Please determine, whether the day will be successful for Mike or not. Print "YES" or "NO" (without quotes) corresponding to the situation.

-----Input-----
The first line of the input contains an integer T denoting the number of test cases. The description of T test cases follows.
The first and only line of each test case contains a single string S denoting the letter code on the ticket.

-----Output-----
For each test case, output a single line containing "YES" (without quotes) in case the day will be successful and "NO" otherwise.

-----Note-----
Two letters x, y where x != y are said to be alternating in a code, if code is of form "xyxyxy...".

-----Constraints-----

- 1 ≤ T ≤ 100
- S consists only of upper-case Latin letters

Subtask 1 (50 points):

- |S| = 2

Subtask 2 (50 points):

- 2 ≤ |S| ≤ 100

-----Example-----
Input:
2
ABABAB
ABC

Output:
YES
NO

Starter code:

Solutions:
def res(s):
 if len(s) == 2:
  if s[0] == s[1]:
   print("NO")
  else:
   print("YES")

 elif s[0] != s[1]:
  counte = 0
  for i in range(2, len(s)):
   if i % 2 == 0:
    if s[i] != s[0]:
     counte = 1
     break
   else:
    if s[i] != s[1]:
     counte = 1
     break

  if counte == 0:
   print("YES")
  else:
   print("NO")
 else:
  print("NO")


def __starting_point():
 t = int(input())
 for _ in range(t):
  stri = str(input())
  res(stri)
__starting_point()

def res(s):
 if len(s) == 2:
  if s[0] == s[1]:
   print("NO")
  else:
   print("YES")

 

 else:
  counte = 0
  for i in range(2, len(s)):
   if i % 2 == 0:
    if s[i] != s[0]:
     counte = 1
     break
   else:
    if s[i] != s[1]:
     counte = 1
     break

  if counte == 0:
   print("YES")
  else:
   print("NO")


def __starting_point():
 t = int(input())
 for _ in range(t):
  stri = str(input())
  res(stri)# cook your dish here

__starting_point()

def res(s):
 if len(s) == 2:
  if s[0] == s[1]:
   print("NO")
  else:
   print("YES")

 elif len(s) % 2 != 0:
  print("NO")

 else:
  counte = 0
  for i in range(2, len(s)):
   if i % 2 == 0:
    if s[i] != s[0]:
     counte = 1
     break
   else:
    if s[i] != s[1]:
     counte = 1
     break

  if counte == 0:
   print("YES")
  else:
   print("NO")


def __starting_point():
 t = int(input())
 for _ in range(t):
  stri = str(input())
  res(stri)# cook your dish here

__starting_point()

def res(s):
 if len(s) == 2:
  if s[0] == s[1]:
   print("NO")
  else:
   print("YES")
 
 elif len(s) % 2 != 0:
  print("NO")
 
 else:
  c1 = s[0]
  c2 = s[1]
  counte = 0
  counto = 0
  for i in range(2, len(s)):
   if i % 2 == 0 and s[i] != c1:
    counte = 1
    break
   elif i % 2 != 0 and s[i] != c2:
    counto = 1
    break

  if counte == 0 or counto == 0:
   print("YES")
 
  else:
   print("NO")


def __starting_point():
 t = int(input())
 for _ in range(t):
  stri = str(input())
  res(stri)

__starting_point()

def res(s):
 if len(s) == 2:
  if s[0] == s[1]:
   print("NO")
  else:
   print("YES")
 
 elif len(s) % 2 != 0:
  print("NO")
 
 else:
  c1 = s[0]
  c2 = s[1]
  counte = 0
  counto = 0
  for i in range(2, len(s)):
   if i % 2 == 0 and s[i] != c1:
    counte = 1
    break
   elif i % 2 != 0 and s[i] != c2:
    counto = 1
    break

  if counte != 0 or counto != 0:
   print("NO")
  else:
   print("YES")


def __starting_point():
 t = int(input())
 for _ in range(t):
  stri = str(input())
  res(stri)

__starting_point()

def res(s):
 if len(s) == 2:
  if s[0] == s[1]:
   print("NO")
  else:
   print("YES")
 else:
  c1 = s[0]
  c2 = s[1]
  counte = 0
  counto = 0
  for i in range(2, len(s)):
   if i % 2 == 0 and s[i] != c1:
    counte = 1
    break
   elif i % 2 != 0 and s[i] != c2:
    counto = 1
    break

  if counte != 0 or counto != 0:
   print("NO")
  else:
   print("YES")


def __starting_point():
 t = int(input())
 for _ in range(t):
  stri = str(input())
  res(stri)

__starting_point()

for t in range(int(input())):
 string = input()
 n = len(string)
 if n == 1:
  print("NO")
 elif n == 2:
  if string[0] != string[1]:
   print("YES")
  else:
   print("NO")
 elif n > 2:
  first = string[0]
  second = string[1]

  if first == second:
   print("NO")
  else:
   flag = 1
   for i in range(2, n):
    if i % 2 != 0:
     if string[i] == second:
      flag = 1
     else:
      flag = 0
      break
    else:
     if string[i] == first:
      flag = 1
     else:
      flag = 0
      break
  if flag == 1 and n == 3:
   print("NO")
  elif flag == 1:
   print("YES")
  else:
   print("NO")

for t in range(int(input())):
 string = input()

 if len(string) == 1:
  print("NO")
 elif len(string) == 2:
  if string[0] != string[1]:
   print("YES")
  else:
   print("NO")
 elif len(string) > 2:
  first = string[0]
  second = string[1]

  if first == second:
   print("NO")
  else:
   flag = 1
   for i in range(2, len(string)):
    if i % 2 != 0:
     if string[i] == second:
      flag = 1
     else:
      flag = 0
      break
    else:
     if string[i] == first:
      flag = 1
     else:
      flag = 0
      break
  if flag == 1:
   print("YES")
  else:
   print("NO")

# cook your dish here
for t in range(int(input())):
 string = input()

 if len(string) == 1:
  print("YES")
 elif len(string) == 2:
  if string[0] != string[1]:
   print("YES")
  else:
   print("NO")
 elif len(string) > 2:
  first = string[0]
  second = string[1]

  if first == second:
   print("NO")
  else:
   flag = 1
   for i in range(2, len(string)):
    if i % 2 != 0:
     if string[i] == second:
      flag = 1
     else:
      flag = 0
      break
    else:
     if string[i] == first:
      flag = 1
     else:
      flag = 0
      break
  if flag == 1:
   print("YES")
  else:
   print("NO")

# cook your dish here
t=int(input())
while(t):
 x=input()
 a=len(x)
 if a==1:
  print("NO")
  
 elif a==2:
  if x[0]==x[1]:
   print("NO")
  else:
   print("YES")
 else:
  if x[0]==x[1]:
   print("NO")
  else:
   for j in range(a-2):
    if x[j]==x[j+2]:
     if j==a-3:
      print("YES")
      break
    else:
     print("NO")
     break
 t-=1


t=int(input())
for i in range (t):
 x=input()
 a=len(x)
 if a==1:
  print("NO")
  
 elif a==2:
  if x[0]==x[1]:
   print("NO")
  else:
   print("YES")
 else:
  if x[0]==x[1]:
   print("NO")
  else:
   for j in range(a-2):
    if x[j]==x[j+2]:
     if j==a-3:
      print("YES")
      break
     else:
      pass
    else:
     print("NO")
     break


for i in range(int(input())):
 x=input()
 a=len(x)
 if a==1:
  print("NO")
  
 elif a==2:
  if x[0]==x[1]:
   print("NO")
  else:
   print("YES")
 else:
  if x[0]==x[1]:
   print("NO")
  else:
   for j in range(a-2):
    if x[j]==x[j+2]:
     if j==a-3:
      print("YES")
      break
     else:
      pass
    else:
     print("NO")
     break
    
 
 


# cook your dish here
for i in range(int(input())):
 s_1=input()
 a=set(s_1)
 if(len(a)==2):
  print("YES")
 else:
  print("NO")

# cook your dish here
t = int(input())
for i in range(t):
 s = input()
 p =set(s)
 if len(p)==2:
  print("YES")
 else:
  print("NO")

# cook your dish here
t = int(input())
for i in range(t):
 s = input()
 l = len(s)
 l1 = l/2
 if l%2==0:
  s1 =""
  a=s[0]
  b=s[1]
  if a!=b:
   s1+=a+b
   if s.count(s1)==l1:
    print("YES")
   else:
    print("NO")
  else:
   print("NO")
 else:
  print("NO")

t=int(input())
for i in range(t):
 s=input()
 l=set(s)
 if(len(l)==2):
  print("YES")
 else:
  print("NO")

# cook your dish here
t=int(input())
while t:
 t=t-1
 s=set(input())
 if len(s)==2:
  print('YES')
 else:
  print('NO')

t= int(input())
for i in range(t):
 s=set(input())
 if len(s)==2:
  print("YES")
 else:
  print("NO")

for i in range(int(input())):
 s=set(input())
 if len(s)==2:
  print("YES")
 else:
  print('NO')


# cook your dish here
for i in range(int(input())):
 x = input()
 y=set(x)
 #print(y)
 print("YES" if len(y) == 2 else "NO")

# cook your dish here
for i in range(int(input())):
 x = input()
 y=set(x)
 if len(y)==2:
  print('YES')
 else:
  print('NO')

try:
 for _ in range(int(input())):
  s=input()
  s=list(s)
  p=set(s)
  cout=0
  if(len(p)==2):
   for i in range(0,len(s)-1):
    if(s[i]==s[i+1]):
     cout=1
  else:
   cout=1
  if(cout==1):
   print("NO")
  else:
   print("YES")
except:
 pass

t = int(input())
for i in range(t):
 s = input()
 if len(set(s))==2:
  print("YES")
 else:
  print("NO")
 
 
 #long method
 # e=""
 # c=0
 # # if len(s)%2==0 and s[0]!=s[1]:
 # #     d=s[0:2]
 # #     for i in range(int(len(s)/2)):
 # #         d=s[2*i:2*(i+1)]
 # #         if i==0:
 # #             e=d
 # #     # e=s[len(s)-2:len(s)]
 # #         if str(d)==str(e):
 # #             c+=1
 # #             e=d
 # #     if c==int(len(s)/2):
 # #         print("YES")
 # #     elif len(s)==2:
 # #         print("YES")
 # #     else:
 # #         print("NO")
 # # else:
 # #     print("NO")