You are given an integer sequence $A_1, A_2, \ldots, A_N$. For any pair of integers $(l, r)$ such that $1 \le l \le r \le N$, let's define $\mathrm{OR}(l, r)$ as $A_l \lor A_{l+1} \lor \ldots \lor A_r$. Here, $\lor$ is the bitwise OR operator.
In total, there are $\frac{N(N+1)}{2}$ possible pairs $(l, r)$, i.e. $\frac{N(N+1)}{2}$ possible values of $\mathrm{OR}(l, r)$. Determine if all these values are pairwise distinct.

-----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 all values of $\mathrm{OR}(l, r)$ are pairwise distinct or "NO" otherwise (without quotes).

-----Constraints-----
- $1 \le T \le 300$
- $1 \le N \le 10^5$
- $0 \le A_i \le 10^{18}$ for each valid $i$
- the sum of $N$ over all test cases does not exceed $3 \cdot 10^5$

-----Example Input-----
4
3
1 2 7
2
1 2
3
6 5 8
5
12 32 45 23 47

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

-----Explanation-----
Example case 1: The values of $\mathrm{OR}(l, r)$ are $1, 2, 7, 3, 7, 7$ (corresponding to the contiguous subsequences $[1], [2], [7], [1,2], [2,7], [1,2,7]$ respectively). We can see that these values are not pairwise distinct.
Example case 2: The values of $\mathrm{OR}(l, r)$ are $1, 2, 3$ (corresponding to the contiguous subsequences $[1], [2], [1, 2]$ respectively) and they are pairwise distinct.

Difficulty: interview

Starter code:

Solutions:
for _ in range(int(input())):
 n = int(input())
 arr = list(map(int,input().split()))

 if n<=62:
  st = set()

  for i in range(n):
   curr = 0
   for j in range(i,n):
    curr = curr|arr[j]

    st.add(curr)
  
  if len(st)==n*(n+1)//2:
   print("YES")
  else:
   print("NO")
   
 else:
  print("NO")

# cook your dish here
def ortho(n,m):
 res=set()
 tot=(n*(n+1))//2
 pre ={0}
 for x in m:
  pre = {x | y for y in pre} | {x}
  res |= pre
 if(len(res)==tot):
  return "YES"
 return "NO"
t=int(input())
for i in range(t):
 n=int(input())
 m=list(map(int, input().split()))
 print(ortho(n,m))

for _ in range(int(input())):
 n=int(input())
 ar=[int(x) for x in input().split()]

 if n>62:
  print("NO")
 else:
  v=[]
  f=0
  for i in range(n):
   x=ar[i]
   if ar[i] not in v:
    v.append(ar[i])
   else:
    f=1
    break
   for j in range(i+1,n):
    x|=ar[j]
    if x in v:
     f=1
     break
    else:
     v.append(x)
   if f==1:
    break
  
  if f==1:
   print("NO")
  else:
   print("YES")
    
    
   
   
   
  
 
  
  


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

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

 if(N>62):
  ans.append('NO')
 else:
  D = {}
  flag = True
  for i in range(N):
   x = 0
   for j in range(i,N):
    x |= A[j]
    if(x in D):
     flag = False
     break
    D[x] = True
   if(not flag):
    break
  if(flag):
   ans.append('YES')
  else:
   ans.append('NO')

for i in ans:
 print(i)


def answer():
 if(n <= 60):
  all_=set()
  for i in range(n):
   value=0
   for j in range(i,n):
    value|=a[j]
    all_.add(value)
  if(len(all_)==n*(n+1)//2):return 'YES'
 return 'NO'
for T in range(int(input())):
 n=int(input())
 a=list(map(int,input().split()))
 print(answer())



def answer():
 if(n <= 60):
  all_=set()
  for i in range(n):
   value=0
   for j in range(i,n):
    value|=a[j]
    all_.add(value)
  if(len(all_)==n*(n+1)//2):return 'YES'
 return 'NO'
for T in range(int(input())):
 n=int(input())
 a=list(map(int,input().split()))

 print(answer())



def answer():
 value=a[0]

 if(n <= 60):
  
  all_=set()
  for i in range(n):
   value=0
   for j in range(i,n):
    value|=a[j]
    all_.add(value)
  
  if(len(all_)==n*(n+1)//2):
   return 'YES'

 
 return 'NO'

for T in range(int(input())):
 n=int(input())
 a=list(map(int,input().split()))

 print(answer())



import math
for t in range(int(input())):
 n=int(input())
 values=list(map(int,input().split()))
 check=set()
 if n>60:
  print("NO")
 else:
  for i in range(n):
   check.add(values[i])
   
  for i in range(n):
   st=0
   for j in range(i,n):
    st=st|values[j]
    check.add(st)
  d=(n*(n+1))//2
  if len(check)==d:
   print("YES")
  else:
   print("NO")


# cook your dish here
for t in range(int(input())):
 n=int(input())
 l=list(map(int,input().split()))
 s=set()
 f=1
 for i in range(n):
  a=l[i]
  for j in range(i,n):
   a|=l[j]
   if(a in s):
    print('NO')
    f=0
    break
   s.add(a)
  if(f==0):
   break
 if(f):
  print('YES')

# cook your dish here
for t in range(int(input())):
 n=int(input())
 l=list(map(int,input().split()))
 s=set()
 f=1
 for i in range(n):
  a=l[i]
  for j in range(i,n):
   a|=l[j]
   if(a in s):
    print('NO')
    f=0
    break
   s.add(a)
  if(f==0):
   break
 if(f):
  print('YES')

for t in range(int(input())):
 n=int(input())
 l=list(map(int,input().split()))
 s=set()
 f=1
 for i in range(n):
  a=l[i]
  for j in range(i,n):
   a|=l[j]
   if(a in s):
    print('NO')
    f=0
    break
   s.add(a)
  if(f==0):
   break
 if(f):
  print('YES')

# cook your dish here
T = int(input())
for _ in range(T):
 n = int(input())
 arr = list(map(int, input().strip().split()))
 s = set()
 if n > 60:
  print("NO")
 else:
  for i in range(n):
   ordd = 0
   for j in range(i, n):
    ordd = ordd | arr[j]
    s.add(ordd)
  if len(s) == n*(n+1) / 2:
   print("YES")
  else:
   print("NO")


# cook your dish here
for _ in range(int(input())):
 n= int(input())
 l=list(map(int,input().split()))
 N=(n)*(n+1)//2
 d=set()
 if n>60:
  print('NO')
 else:
  for i in range(n):
   ans=0
   for j in range(i,n):
    ans=l[j]|ans 
    d.add(ans)
  if len(d)==N:
   print('YES')
  else:
   print('NO')

# cook your dish here
def main():
 t = int(input())
 for _ in range(t):
  n = int(input())
  ar = list(map(int, input().split()))
  if n > 62:
   print("NO")
   continue
  lk = set()
  ok = True
  for sz in range(1, n + 1):
   idx = 0
   while idx + sz - 1 < n:
    curr = 0
    for j in range(idx, idx + sz):
     curr = curr | ar[j]
    if curr in lk:
     ok = False
     break
    else:
     lk.add(curr)
    idx += 1
  if ok:
   print("YES")
  else:
   print("NO")

def __starting_point():
 main()
__starting_point()

t = int(input())
while t!= 0:
 n = int(input())
 ls = list(map(int,input().split()))
 p ={0}
 res = set()
 for i in ls:
  p = {i|y for y in p} | {i}
  res |= p
 if len(res) ==(n*(n+1))//2:
  print("YES")
 else:
  print("NO")
 t-=1

# cook your dish here
def subArrayBitWiseOR(A):
 res=set()
 pre={0}
 for x in A:
  pre={x | y for y in pre} | {x}
  res|=pre
 return(len(res))
t=int(input())
while(t>0):
 t-=1
 n=int(input())
 a=list(map(int,input().split()))
 d=subArrayBitWiseOR(a)
 if(d==(n*(n+1))/2):
  print("YES")
 else:
  print("NO")

t = int(input())
while t!= 0:
 n = int(input())
 ls = list(map(int,input().split()))
 p ={0}
 res = set()
 for i in ls:
  p = {i|y for y in p} | {i}
  res |= p
 if len(res) ==(n*(n+1))//2:
  print("YES")
 else:
  print("NO")
 t-=1


t=int(input())
for k in range(t):
 n=int(input())
 arr=list(map(int,input().split()))
 set1=[]
 for i in range(n):
  if arr[i] in set1:
   f=1
   print("NO")
   break
  else:
   f=0
   set1.append(arr[i])
  for j in range(i+1,n):
   arr[i]=arr[i]|arr[j]
   if arr[i] in set1:
    f=1
    print("NO")
    break
   else:
    set1.append(arr[i])
    f=0
  if f==1:
   break
 if f==0:
   print("YES")
   
   
   
 
 


T = int(input())
while T:
 N = int(input())
 A = list(map(int, input().split()))
 d = set()
 n = (N * (N + 1)) // 2
 if N > 60:
  print("NO")
 else:
  for i in range(N):
   ans = 0
   for j in range(i, N):
    ans = A[j] | ans
    d.add(ans)
  if len(d) == n:
   print("YES")
  else:
   print("NO")

 T -= 1

# cook your dish here
def solve(A): 
 res, pre=set(),{0}
 for x in A: 
  pre={x|y for y in pre}|{x} 
  res|=pre 
 return len(res) 
 
test=int(input())
for _ in range(test):
 n=int(input())
 arr=list(map(int,input().split()))
 if(solve(arr)!=n*(n+1)//2):
  print('NO')
 else:
  print('YES')


def solve(A): 
 res, pre = set(), {0}
 for x in A: 
  pre = {x | y for y in pre} | {x} 
  res |= pre 
 return len(res) 
 

for t in range(int(input())):
 n = int(input())
 arr = list(map(int, input().split()))
 if(solve(arr) != n*(n+1)//2):
  print('NO')
 else:
  print('YES')


try:
 t=int(input())
 if 1<=t<=300:
  for T in range(t):
   n=int(input())
   a=list(map(int,input().split()))
   a.sort(reverse=True)
   to_add=a[0]
   f=0
   for i in range(1,n):
    to_add=to_add|a[i]
    if to_add in a:
     f=1
     break
    a.append(to_add)
   if f==1:
    print("NO")
   else:
    print("YES")
except:
 pass



for _ in range(int(input())):
 n=int(input())
 a=list(map(int,input().split()))
 a.sort(reverse=True)
 to_add=a[0]
 f=0
 for i in range(1,n):
  to_add=to_add|a[i]
  if to_add in a:
   f=1
   break
  a.append(to_add)
 if f==0:
  print("YES")
 else:
  print("NO")

for _ in range(int(input())):
 n=int(input())
 a=list(map(int,input().split()))
 tot=(n*(n+1))//2
 ans=a.copy()
 to_add=0
 if n>62:
  print("NO")
  continue
 for i in range(n-1):
  to_add=a[i]
  for j in range(i+1,n):
   to_add=to_add|a[j]
   ans.append(to_add)
 if len(set(ans))==tot:
  print("YES")
 else:
  print("NO")

for _ in range(int(input())):
 n=int(input())
 a=list(map(int,input().split()))
 tot=(n*(n+1))//2
 ans=a.copy()
 to_add=0
 if n>=62:
  print("NO")
  continue
 for i in range(n-1):
  to_add=a[i]
  for j in range(i+1,n):
   to_add=to_add|a[j]
   ans.append(to_add)
 if len(set(ans))==tot:
  print("YES")
 else:
  print("NO")