Tzuyu gave Nayeon a strip of $N$ cells (numbered $1$ through $N$) for her birthday. This strip is described by a sequence $A_1, A_2, \ldots, A_N$, where for each valid $i$, the $i$-th cell is blocked if $A_i = 1$ or free if $A_i = 0$. Tzuyu and Nayeon are going to use it to play a game with the following rules:
- The players alternate turns; Nayeon plays first.
- Initially, both players are outside of the strip. However, note that afterwards during the game, their positions are always different.
- In each turn, the current player should choose a free cell and move there. Afterwards, this cell becomes blocked and the players cannot move to it again.
- If it is the current player's first turn, she may move to any free cell.
- Otherwise, she may only move to one of the left and right adjacent cells, i.e. from a cell $c$, the current player may only move to the cell $c-1$ or $c+1$ (if it is free).
- If a player is unable to move to a free cell during her turn, this player loses the game.
Nayeon and Tzuyu are very smart, so they both play optimally. Since it is Nayeon's birthday, she wants to know if she can beat Tzuyu. Find out who wins.

-----Input-----
- The first line of the input contains a single integer $T$ denoting the number of test cases. The description of $T$ test cases follows.
- The first line of each test case contains a single integer $N$.
- The second line contains $N$ space-separated integers $A_1, A_2, \ldots, A_N$.

-----Output-----
For each test case, print a single line containing the string "Yes" if Nayeon wins the game or "No" if Tzuyu wins (without quotes).

-----Constraints-----
- $1 \le T \le 40,000$
- $2 \le N \le 3\cdot 10^5$
- $0 \le A_i \le 1$ for each valid $i$
- $A_1 = A_N = 1$
- the sum of $N$ over all test cases does not exceed $10^6$

-----Subtasks-----
Subtask #1 (50 points): $A_i = 0$ for each $i$ ($2 \le i \le N-1$)
Subtask #2 (50 points): original constraints

-----Example Input-----
4
7
1 1 0 0 0 1 1
8
1 0 1 1 1 0 0 1
4
1 1 0 1
4
1 1 1 1

-----Example Output-----
Yes
No
Yes
No

-----Explanation-----
Example case 1: Since both Nayeon and Tzuyu play optimally, Nayeon can start e.g. by moving to cell $4$, which then becomes blocked. Tzuyu has to pick either the cell $3$ or the cell $5$, which also becomes blocked. Nayeon is then left with only one empty cell next to cell $4$ (the one Tzuyu did not pick); after she moves there, Tzuyu is unable to move, so she loses the game.
Example case 2: Regardless of what cell Nayeon moves to at the start, Tzuyu will always be able to beat her.

Difficulty: interview

Starter code:

Solutions:
for _ in range(int(input())):
 n=int(input())


 def maxConsequtiveOnes(lst):
  _max = 0
  _ones = [0]
  for i in lst:
   if i == 0:
    _max += 1
   if i == 1:
    _max = 0
   _ones.append(_max)
  return max(_ones)


 a = list(map(int, input().split()))
 b = maxConsequtiveOnes(a)
 if (b % 2 == 0):
  print("No")
 else:
  print("Yes")



def isOdd(slen):
 m = -float('inf')
 mi = None
 for i in range(len(slen)):
  if(slen[i]%2==1 and slen[i]>m):
   mi = i
   m = slen[i]
 return mi

def find_even(slen,mi):
 for i in range(len(slen)):
  if(i!=mi and slen[i]>slen[mi]//2):
   return False
 return True

T = int(input())
ans = []

for _ in range(T):
 N = int(input())
 A = [int(i) for i in input().split()]

 slen = []
 i = 0
 while(i<N):
  if(A[i]==0):
   e = i
   while(e<N and A[e]==0):
    e += 1
   slen.append(e-i)
   i = e + 1
  else:
   i += 1

 x = isOdd(slen)
 if(len(slen)!=0 and x!=None and find_even(slen,x)):
  ans.append('Yes')
 else:
  ans.append('No')

for i in ans:
 print(i)


def isOne(slen):
 count = 0
 for i in slen:
  if(i==1):
   count += 1
  else:
   return False
 return count==1

def isOdd(slen):
 for i in slen:
  if(i%2==1 and i>1):
   return True
 else:
  return False

T = int(input())
ans = []

for _ in range(T):
 N = int(input())
 A = [int(i) for i in input().split()]

 slen = []
 i = 0
 while(i<N):
  if(A[i]==0):
   e = i
   while(e<N and A[e]==0):
    e += 1
   slen.append(e-i)
   i = e + 1
  else:
   i += 1

 if(len(slen)!=0 and (isOne(slen) or isOdd(slen)) ):
  ans.append('Yes')
 else:
  ans.append('No')

for i in ans:
 print(i)


test_case = int(input())
while test_case > 0:
 test_case -= 1
 n= int(input())
 arr = [int(x) for x in input().split()]
 c = list()
 temp = 0
 for a in arr:
  if a == 0:
   temp += 1
  else:
   c.append(temp)
   temp = 0
 c.append(temp)
 max1 = max(c)
 c.remove(max1)
 max2 = max(c)
 if max1 % 2 == 0 or (max1/2 + (max1 & 1)) <= max2 :
  print("No")
 else:
  print("Yes")

test_case = int(input())
while test_case > 0:
 test_case -= 1
 n= int(input())
 arr = [int(x) for x in input().split()]
 c = list()
 temp = 0
 times = 0
 flag = True
 for a in arr:
  if a == 0:
   temp += 1
   if flag:
    flag = False
    times += 1
  else:
   # c = max(c,temp)
   c.append(temp)
   temp = 0
   flag = True
 c.append(temp)
 max1 = max(c)
 c.remove(max1)
 max2 = max(c)
 if max1 % 2 == 0 or (max1/2 + (max1 & 1)) <= max2 :
  print("No")
 else:
  print("Yes")

test_case = int(input())
while test_case > 0:
 test_case -= 1
 n= int(input())
 arr = [int(x) for x in input().split()]
 c = list()
 temp = 0
 times = 0
 flag = True
 for a in arr:
  if a == 0:
   temp += 1
   if flag:
    flag = False
    times += 1
  else:
   # c = max(c,temp)
   c.append(temp)
   temp = 0
   flag = True
 c.append(temp)
 max1 = max(c)
 c.remove(max1)
 max2 = max(c)
 if max1 % 2 == 0 or (max1/2 + (max1 & 1)) <= max2 :
  print("No")
 else:
  print("Yes")

test_case = int(input())
while test_case > 0:
 test_case -= 1
 n= int(input())
 arr = [int(x) for x in input().split()]
 c = list()
 temp = 0
 times = 0
 flag = True
 for a in arr:
  if a == 0:
   temp += 1
   if flag:
    flag = False
    times += 1
  else:
   # c = max(c,temp)
   c.append(temp)
   temp = 0
   flag = True
 # if c % 2 == 0 :
 #     print("No")
 # else:
 #     print("Yes")
 c.append(temp)
 max1 = max(c)
 c.remove(max1)
 max2 = max(c)
 if max1 % 2 == 0 or (max1/2 + (max1 & 1)) < max2 :
  print("No")
 else:
  print("Yes")

test_case = int(input())
while test_case > 0:
 test_case -= 1
 n= int(input())
 arr = [int(x) for x in input().split()]
 c = list()
 temp = 0
 times = 0
 flag = True
 for a in arr:
  if a == 0:
   temp += 1
   if flag:
    flag = False
    times += 1
  else:
   # c = max(c,temp)
   c.append(temp)
   temp = 0
   flag = True
 # if c % 2 == 0 :
 #     print("No")
 # else:
 #     print("Yes")
 c.append(temp)
 max1 = max(c)
 c.remove(max1)
 max2 = max(c)
 if max1 % 2 == 0 or max1 == max2 :
  print("No")
 else:
  print("Yes")

test_case = int(input())
while test_case > 0:
 test_case -= 1
 n= int(input())
 arr = [int(x) for x in input().split()]
 c = list()
 temp = 0
 times = 0
 flag = True
 for a in arr:
  if a == 0:
   temp += 1
   if flag:
    flag = False
    times += 1
  else:
   # c = max(c,temp)
   c.append(temp)
   temp = 0
   flag = True
 # if c % 2 == 0 :
 #     print("No")
 # else:
 #     print("Yes")
 max1 = max(c)
 c.remove(max1)
 max2 = max(c)
 if max1 % 2 == 0 or max1 == max2 :
  print("No")
 else:
  print("Yes")

test_case = int(input())
while test_case > 0:
 test_case -= 1
 n= int(input())
 arr = [int(x) for x in input().split()]
 c = 0
 temp = 0
 times = 0
 flag = True
 for a in arr:
  if a == 0:
   temp += 1
   if flag:
    flag = False
    times += 1
  else:
   c = max(c,temp)
   temp = 0
   flag = True
 if c % 2 == 0 :
  print("No")
 else:
  print("Yes")

from collections import defaultdict
import math

for t in range(int(input())):
 n=int(input())
 store=list(map(int,input().split()))
 count=0
 curr=0
 cStore=defaultdict()
 maxi=0
 second=0
 
 for i in range(n):
  if store[i]==0:
   if curr>0:
    curr+=1
   else:
    curr=1
  else:
   if curr>maxi:
    second=maxi
    maxi=curr
   elif curr>second:
    second=curr
   curr=0
 if second!=0 and math.ceil(maxi/2)<=second:
  print("No")
 else:
  if maxi%2==0:
   print("No")
  else:
   print("Yes")
  


   
 


from collections import defaultdict
import math

for t in range(int(input())):
 n=int(input())
 store=list(map(int,input().split()))
 count=0
 curr=0
 cStore=defaultdict()
 maxi=0
 second=0
 
 for i in range(n):
  if store[i]==0:
   if curr>0:
    curr+=1
   else:
    curr=1
  else:
   if curr>maxi:
    second=maxi
    maxi=curr
   elif curr>second:
    second=curr
   curr=0
 if second!=0 and math.ceil(maxi/2)<second:
  print("No")
 else:
  if maxi%2==0:
   print("No")
  else:
   print("Yes")
  


   
 


from collections import defaultdict

for t in range(int(input())):
 n=int(input())
 store=list(map(int,input().split()))
 count=0
 curr=0
 cStore=defaultdict()
 for i in range(n):
  if store[i]==0:
   if curr>0:
    curr+=1
   else:
    curr=1
  else:
   if curr!=0:
    if curr in cStore:
     cStore[curr]+=1
    else:
     cStore[curr]=1
    curr=0
 if curr!=0:
  if curr in cStore:
   cStore[curr]+=1
  else:
   cStore[curr]=1
 flag=0
 maxi=0
 for val in cStore:
  if val>maxi:
   maxi=val
   
 for val in cStore:
  if cStore[val]==maxi and cStore[val]>1:
   flag=1
   break
 if flag==1:
  print("No")
 else:
  if maxi%2==0:
   print("No")
  else:
   print("Yes")
   
 


from collections import defaultdict

for t in range(int(input())):
 n=int(input())
 store=list(map(int,input().split()))
 count=0
 curr=0
 cStore=defaultdict()
 for i in range(n):
  if store[i]==0:
   if curr>0:
    curr+=1
   else:
    curr=1
  else:
   if curr!=0:
    if curr in cStore:
     cStore[curr]+=1
    else:
     cStore[curr]=1
    curr=0
 flag=0
 maxi=0
 for val in cStore:
  if cStore[val]>1:
   flag=1
   break
  elif val>maxi:
   maxi=val
 if flag==1:
  print("No")
 else:
  if maxi%2==0:
   print("No")
  else:
   print("Yes")
   
 


for t in range(int(input())):
 n=int(input())
 store=list(map(int,input().split()))
 count=0
 curr=0
 for i in range(n):
  if store[i]==0:
   if curr>0:
    curr+=1
   else:
    curr=1
  else:
   if curr>count:
    count=curr
   curr=0
 if curr>count:
  count=curr
 if count%2==0:
  print("No")
 else:
  print("Yes")


for _ in range(int(input())):
 n = int(input())
 a = list(map(int,input().split()))
 fmax=smax=count= 0
 for i in range(n):
  if a[i]==1:
   if count!=0:
    if count>fmax:
     smax = fmax 
     fmax = count
    elif count>smax:
     smax = count
    count = 0 
  else:
   count+=1
 if (fmax%2!=0 and smax<(fmax+1)//2):
  print("Yes")
 else:
  print("No")


# cook your dish here
t=int(input())

while(t>0):
 n=int(input())
 str1=str(input()).split(" ")
 str1=list(map(int,str1))
 output="No"
 totalCount=0
 count=0
 # print(str1)
 for i in str1:
  if i==0:
   count+=1
   totalCount+=1
  
  elif i==1 and count>0:
   # print(count)
   if(count%2==1 and totalCount!=1):
    output="Yes"
    break
   count=0
   
 if(str1[-1]==0 and count%2==1 and totalCount!=1):
  output="Yes"
  
 if totalCount==1:
  output="Yes"
 print(output)
 t=t-1
  


for i in range(int(input())):
 n = int(input())
 l = list(map(int, input().split()))

 streaks=[]
 curr_streak=0

 for i in range(n):
  if l[i]==0:
   curr_streak+=1
  else:
   if curr_streak>0:
    streaks.append(curr_streak)
   curr_streak=0

 num_ones=0

 all_even_f=1
 
 for e in streaks:
  if e==1: num_ones+=1

  elif e%2:
   all_even_f=0

 if num_ones==1 and set(streaks)=={1}:
  print('Yes')
  continue

 if all_even_f:
  print('No')
 else:
  print('Yes')
  


# cook your dish here
for _ in range(int(input())):
 n=int(input())
 s=input().split()
 s=''.join(s).split('1')
 l=[]
 for i in s:
  if len(i)==0:
   continue
  else:
   l.append(i)
 l.sort(reverse=True,key=len)
 if len(l)==0:
   print('No')
 elif len(l)==1:
  if len(l[0])%2==0:
   print('No')
  else:
   print('Yes')
 else:
  m1,m2=len(l[0]),len(l[1])
  if m1%2==0:
   print('No')
  else:
   if m1%2 and (m1+1)/2>m2:
    print('Yes')
   else:
    print('No')


# cook your dish here
t = int(input())
for _ in range(t):
 n = int(input())
 s = input().split()
 s = "".join(s).split('1')
 l = []
 for i in s:
  if len(i):
   l.append(i)
 l.sort(reverse = True, key = len)
 if len(l) == 0:
  print("No")
 else:
  if len(l) == 1:
   if len(l[0])%2!=0:
    print("Yes")
   else:
    print('No')
  else:
   m1,m2 = len(l[0]), len(l[1])
   if m1%2 == 0:
    print("No")
   else:
    if m1%2 and (m1+1)//2>m2:
     print("No")
    else:
     print("Yes")


# cook your dish here
t = int(input())
for _ in range(t):
 n = int(input())
 s = input().split()
 s = "".join(s).split('1')
 l = []
 for i in s:
  if len(i):
   l.append(i)
 l.sort(reverse = True, key = len)
 if len(l) == 0:
  print("No")
 else:
  if len(l) == 1:
   if len(l[0])%2!=0:
    print("Yes")
   else:
    print('No')
  else:
   m1,m2 = len(l[0]), len(l[1])
   if m1%2 == 0:
    print("No")
   else:
    if (m1+1)//2>m2:
     print("No")
    else:
     print("Yes")