Due to the COVID pandemic, people have been advised to stay at least $6$ feet away from any other person. Now, people are lining up in a queue at the local shop and it is your duty to check whether they are all following this advice.
There are a total of $N$ spots (numbered $1$ through $N$) where people can stand in front of the local shop. The distance between each pair of adjacent spots is $1$ foot. Each spot may be either empty or occupied; you are given a sequence $A_1, A_2, \ldots, A_N$, where for each valid $i$, $A_i = 0$ means that the $i$-th spot is empty, while $A_i = 1$ means that there is a person standing at this spot. It is guaranteed that the queue is not completely empty.
For example, if $N = 11$ and the sequence $A$ is $(0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1)$, then this is a queue in which people are not following the advice because there are two people at a distance of just $3$ feet from each other.
You need to determine whether the people outside the local shop are following the social distancing advice or not. As long as some two people are standing at a distance smaller than 6 feet from each other, it is bad and you should report it, since social distancing is not being followed.

-----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 next 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 social distancing is being followed or "NO" otherwise (without quotes).

-----Constraints-----
- $1 \le T \le 100$
- $1 \le N \le 100$
- $0 \le A_i \le 1$ for each valid $i$
- at least one spot is occupied

-----Subtasks-----
Subtask #1 (100 points): original constraints

-----Example Input-----
3
3
1 0 1
7
1 0 0 0 0 0 1
11
0 1 0 0 0 0 0 1 0 0 1

-----Example Output-----
NO
YES
NO

-----Explanation-----
Example case 1: The first and third spots are occupied and the distance between them is $2$ feet.
Example case 2: The first and seventh spots are occupied and the distance between them is $6$ feet.

Difficulty: interview

Starter code:

Solutions:
# cook your dish here
t=int(input())
while t>0:
    n=int(input())
    l=list(map(int,input().split()))
    l1=[]
    c=1
    for i in range(len(l)):
        if l[i]==1:
            l1.append(i)
    for j in range(len(l1)-1):
        if l1[j+1]-l1[j]<6:
            c=0
            break
    if c:
        print("YES")
    else:
        print("NO")
            
    t-=1

T=int(input())
for i in range(T):
    N=int(input())
    L=list(map(int,input().split()))[:N]
    a,b=[],[]
    for j in range(len(L)):
        if L[j]==1:
            a.append(j)
    for k in range(len(a)-1):
        b.append(a[k+1]-a[k])
    for l in range(len(b)):
        if b[l]<6:
            print("NO")
            break
    else:
        print("YES")

T=int(input())
for i in range(T):
    N=int(input())
    L=list(map(int,input().split()))[:N]
    a,b=[],[]
    for j in range(len(L)):
        if L[j]==1:
            a.append(j)
    for k in range(len(a)-1):
        b.append(a[k+1]-a[k])
    for l in range(len(b)):
        if b[l]<6:
            print("NO")
            break
    else:
        print("YES")

T=int(input())
for i in range(T):
    N=int(input())
    L=list(map(int,input().split()))[:N]
    a,b=[],[]
    for j in range(len(L)):
        if L[j]==1:
            a.append(j)
    for k in range(len(a)-1):
        b.append(a[k+1]-a[k])
    for l in range(len(b)):
        if b[l]<6:
            print("NO")
            break
    else:
        print("YES")


# cook your dish here
for _ in range(int(input())) :
    N = int(input().strip())
    A = list(map(int, input().split()))
    m1 = 0
    ma = 0
    mc = 1
    for i in range(N) :
        if A[i] == 1 :
            ma = ma + 1
            if ma > 1 and m1 < 5 :
                mc = 0
                print("NO")
                break
            m1 = 0
        else :
            m1 = m1 + 1
    #     print(i, A[i], ma, m1)
    if mc == 1 :
        print("YES")

# cook your dish here
for _ in range(int(input())):
    n = int(input())
    l =  list(map(int,input().split()))
    # 101 --- 1000001 ----
    f = True
    for i in range(n):
        if(l[i]==1):
            if(i+1 < n):
                if(l[i+1]==1):
                    f=False
                    break
            if(i+2 < n):
                if(l[i+2]==1):
                    f=False
                    break
            if(i+3 < n):
                if(l[i+3]==1):
                    f=False
                    break
            if(i+4 < n):
                if(l[i+4]==1):
                    f=False
                    break
            if(i+5 < n):
                if(l[i+5]==1):
                    f=False
                    break
    if(f==True):
        print('YES')
    else:
        print('NO')

# cook your dish here
for _ in range(int(input())):
    n=int(input())
    l1=list(map(int,input().split()))
    flag=0
    l2=[]
    for i in range(len(l1)):
        if l1[i]==1:
            l2.append(i)
    for i in range(len(l2)-1):
        if l2[i+1]-l2[i]<6:
            flag=1
            break
    if flag==0:
        print("YES")
    else:
        print("NO")


# cook your dish here
t=int(input())
for i in range(t):
    n=int(input())
    a=[]
    a=list(map(int,input().split()))
    x=[]
    for j in range(n):
        if a[j]==1:
            x.append(j)
    k=len(x)
    flag=0
    for j in range(k-1):
        if abs(x[j]-x[j+1])<6:
            flag=1
            break
    if flag==0:
        print('YES')
    else:
        print("NO")
    

for _ in range(int(input())):
    n = int(input())
    l = list(map(int,input().split()))
    ans = "YES"
    if n<=6:
        x = l.count(1)
        if x>1:
            ans = "NO"
    else:
        for i in range(n-5):
            x = l[i:i+6].count(1)
            if x>1:
                ans = "NO"
                break 
    print(ans)        

# cook your dish here
t=int(input())
for _ in range(t):
    n=int(input())
    l=list(map(int,input().split()))
    l=[ i for i in range(len(l)) if l[i] == 1 ]
    social_distance=True
    for i in range(1,len(l)):
        if l[i]-l[i-1]<6:
            social_distance=False
            break
    if social_distance==False:
        print('NO')
    else:
        print('YES')
    

# cook your dish here
t=int(input())
for _ in range(t):
    n=int(input())
    l=list(map(int,input().split()))
    l=[ i for i in range(len(l)) if l[i] == 1 ]
    social_distance=True
    for i in range(1,len(l)):
        if l[i]-l[i-1]<6:
            social_distance=False
    if social_distance==False:
        print('NO')
    else:
        print('YES')
    

# cook your dish here
for T in range(int(input())):
    n = int(input())
    ls = list(map(int,input().split()))
    flag1 = 0
    lr = []
    for i in range(n):
        if ls[i]==1:
            lr.append(i+1)
    # print(lr)
    if len(lr)==1:
        print("YES")
    else:
        for j in range(1,len(lr)):
            if (lr[j]-lr[j-1])>=6:
                flag1 = 1 
            else:
                flag1 = 0 
                break
            
        if flag1==1:
            print("YES")
        else:
            print("NO")
            

# cook your dish here
def covid(n,m):
    p=False
    for j in range(len(m)):
        if(m[j]==1 and p==False):
            k=j
            p=True
        elif(m[j]==1 and p):
            if(j-k<6):
                return "NO"
            else:
                k=j
    return "YES"
t=int(input())
for i in range(t):
    n=int(input())
    m=list(map(int,input().split()))
    print(covid(n,m))
    

# cook your dish here
t=int(input())
while t>0:
    n=int(input())
    l=list(map(int,input().split()))
    l1=[]
    c=True
    for i in range(len(l)):
        if l[i]==1:
            l1.append(i)
    for j in range(len(l1)-1):
        if l1[j+1]-l1[j]<6:
            c=False
            break
    if c:
        print("YES")
    else:
        print("NO")
            
    t-=1

# cook your dish here
for _ in range(int(input())):
    n=int(input())
    a=list(map(int,input().split()))
    pos=[]
    for i in range(len(a)):
        if a[i]==1:
            pos.append(i)
    for i in range(1,len(pos)):
        if pos[i]-pos[i-1]<6:
            print('NO')
            break
    else:
        print('YES')

for test_ in range(int(input())):
    n = int(input())
    a = list(map(int,input().strip().split()))
    temp = []
    for i in range(n):
        if a[i] == 1:
            temp.append(i)
    if len(temp) == 1:
        print("YES")
    else:
        dist = []
        for i in range(1,len(temp)):
            dist.append(temp[i]-temp[i-1])
        print("YES" if min(dist)>=6 else "NO")

# cook your dish here
t=int(input())
while t>0:
    n=int(input())
    l=list(map(int,input().split()))
    m=[]
    for i in range(n):
        if l[i]==1:
            m.append(i)
    if len(m)==1:
        print("YES")
    else:
        diff=[]
        for i in range(1,len(m)):
            diff.append(m[i]-m[i-1])
        for i in diff:
            if i<6:
                print("NO")
                break
        else:
            print("YES")
    t-=1

# cook your dish here
for _ in range(int(input())):
    N=int(input())
    inp_lst=tuple(i for i in input().strip().split(' '))
    idx_lst=[]
    printStr='YES'
    for i in range(N):
        if(inp_lst[i]=='1'):
            idx_lst.append(i)
            
    for i in range(1,len(idx_lst)):
        if(idx_lst[i]-idx_lst[i-1]<6):
            printStr='NO'
            break
        
    print(printStr)
    


import sys
cases = int(sys.stdin.readline().rstrip())
for case in range(cases):
    N = int(sys.stdin.readline().rstrip())
    p = list(map(int,sys.stdin.readline().rstrip().split(" ")))
    idxs=[]
    for (i,v) in enumerate(p):
        if(v == 1):
            idxs.append(i)
    error = False
    for i in range(len(idxs)-1):
        if idxs[i+1] - idxs[i]  < 6:
            error = True
            break
    if(error):
        print("NO")
    else :
        print("YES")
        
        


for _ in range(int(input())):
    # x,y,s = map(int,input().split())
    n = int(input())
    a = input()
    if '1 1' in a or '1 0 1' in a or '1 0 0 1' in a or '1 0 0 0 1' in a or '1 0 0 0 0 1' in a :
        print('NO')
    else :
        print('YES')


import sys
cases = int(sys.stdin.readline().rstrip())
for case in range(cases):
    N = int(sys.stdin.readline().rstrip())
    p = list(map(int,sys.stdin.readline().rstrip().split(" ")))
    idxs=[]
    for (i,v) in enumerate(p):
        if(v == 1):
            idxs.append(i)
    error = False
    for i in range(len(idxs)-1):
        if idxs[i+1] - idxs[i]  < 6:
            error = True
            break
    if(error):
        print("NO")
    else :
        print("YES")
        
        

# cook your dish here
for _ in range(int(input())):
    N = int(input())
    A = list(map(int,input().strip().split()))
    Positions = []
    not_followed = 0
    for i in range(N):
        if A[i] == 1 : 
            Positions.append(i+1)
    for i in range(len(Positions)-1):
        if (Positions[i+1] - Positions[i]) < 6 : not_followed += 1
    if not_followed == 0 : print('YES')
    else : print('NO')

t = int(input())

for _ in range(t):
    n = int(input())
    arr = [int(x) for x in input().split()]
    
    one = [i for i, x in enumerate(arr) if x == 1]
    
    flag = 0
    
    for i in range(1, len(one)):
        if(one[i]-one[i-1] < 6):
            flag = 1
            break
    
    if(flag == 1):
        print("NO")
    else:
        print("YES")

for _ in range(int(input())):
    n=int(input())
    s=list(map(int,input().split()))
    l=[]
    c=0
    for i in range(n):
        if s[i]==1:
            l.append(i)
    for i in range(len(l)-1):
        if l[i+1]-l[i]<6:
            c+=1
    if c>0:
        print("NO")
    else:
        print("YES")
        
    

t=int(input())

while t>0:
    t-=1
    n=int(input())
    
    l1=[int(i) for i in input().split(" ")]
    
    ans=""
    
    flag=0
    k=0
    for i in l1:
        if flag==1 and i!=1:
            k+=1
        elif i==1 and flag==0:
            flag=1
        elif i==1 and flag==1:
            if k>=5:
                k=0
            else:
                ans="NO"
                break
    if ans=="":
        ans="YES"
    print(ans)