You are playing a variation of game 2048. Initially you have a multiset $s$ of $n$ integers. Every integer in this multiset is a power of two. 

You may perform any number (possibly, zero) operations with this multiset.

During each operation you choose two equal integers from $s$, remove them from $s$ and insert the number equal to their sum into $s$.

For example, if $s = \{1, 2, 1, 1, 4, 2, 2\}$ and you choose integers $2$ and $2$, then the multiset becomes $\{1, 1, 1, 4, 4, 2\}$.

You win if the number $2048$ belongs to your multiset. For example, if $s = \{1024, 512, 512, 4\}$ you can win as follows: choose $512$ and $512$, your multiset turns into $\{1024, 1024, 4\}$. Then choose $1024$ and $1024$, your multiset turns into $\{2048, 4\}$ and you win.

You have to determine if you can win this game.

You have to answer $q$ independent queries.


-----Input-----

The first line contains one integer $q$ ($1 \le q \le 100$) – the number of queries.

The first line of each query contains one integer $n$ ($1 \le n \le 100$) — the number of elements in multiset.

The second line of each query contains $n$ integers $s_1, s_2, \dots, s_n$ ($1 \le s_i \le 2^{29}$) — the description of the multiset. It is guaranteed that all elements of the multiset are powers of two. 


-----Output-----

For each query print YES if it is possible to obtain the number $2048$ in your multiset, and NO otherwise.

You may print every letter in any case you want (so, for example, the strings yEs, yes, Yes and YES will all be recognized as positive answer).


-----Example-----
Input
6
4
1024 512 64 512
1
2048
3
64 512 2
2
4096 4
7
2048 2 2048 2048 2048 2048 2048
2
2048 4096

Output
YES
YES
NO
NO
YES
YES



-----Note-----

In the first query you can win as follows: choose $512$ and $512$, and $s$ turns into $\{1024, 64, 1024\}$. Then choose $1024$ and $1024$, and $s$ turns into $\{2048, 64\}$ and you win.

In the second query $s$ contains $2048$ initially.

Difficulty: interview

Starter code:

Solutions:
for i in range(int(input())):
    n=int(input())
    s=list(map(int,input().split()))
    a=0
    for i in s:
        if i<2049:a+=i
    if a<2048:print("NO")
    else:print("YES")

t=int(input())
for i in range(t):
    n=int(input())
    a=list(map(int,input().split()))
    a.sort(reverse=True)
    s=0
    for j in a:
        if j<=2048:
            s+=j
        if s==2048:
            print("YES")
            break
    else:
        print("NO")



q = int(input())
for i in range(q):
    n = int(input())
    a = [int(x) for x in input().split()]
    a.sort()
    s = 0
    for i in a:
        if i <= 2048:
            s += i
    print("YES" if s >= 2048 else "NO")


for _ in range(int(input())):
	n = int(input())
	a = [*map(int, input().split())]
	a.sort(reverse=True)
	t = 2048

	for i in a:
		if t - i >= 0:
			t -= i

	print(['NO', 'YES'][t == 0])

q = int(input())
while q:
    n = int(input())
    a = list(map(int, input().split()))
    a.sort()
    i = 0
    d = False
    while i < len(a) - 1:
        if 2048 in a:
            d = True
            break
        if a[i] == a[i + 1]:
            a.append(a[i] + a[i + 1])
            a.sort()
            i += 2
        else:
            i += 1  
    if 2048 in a:
        d = True
    if d:
        print("YES")
    else:
        print("NO")
    q -= 1

t=int(input())
for nt in range(t):
	n=int(input())
	l=list(map(int,input().split()))
	new=[]
	for i in l:
		if i<=2048:
			new.append(i)
	new.sort()
	if 2048 in new:
		print ("YES")
	else:
		s=0
		flag=0
		for i in range(len(new)-1,-1,-1):
			s+=new[i]
			if s==2048:
				print ("YES")
				flag=1
				break
		if flag==0:
			print ("NO")

for _ in range(int(input())):
    n=int(input())
    arr=list(map(int,input().split()))
    s=0
    for i in arr:
        if i<=2048:
            s+=i
    if s>=2048:
        print("YES")
    else:
        print("NO")



import sys
from collections import defaultdict
from itertools import combinations
from itertools import permutations
input = lambda : sys.stdin.readline().rstrip()
def write(*args, sep=" "):
  for i in args:
    sys.stdout.write("{}".format(i) + sep)
INF = float('inf')
MOD = int(1e9 + 7)

for t in range(int(input())):
  n = int(input())
  arr = list(map(int, input().split()))
  d = defaultdict(int) 

  for i in arr:
    d[i] += 1
  
  for i in range(0, 11):
    x = d[1 << i] // 2
    d[1 << (i + 1)] += x 
  if d[2048]:
    print("YES")
  else:
    print("NO")



q = int(input())
for rew in range(q):
	n = int(input())
	l = list(map(int,input().split()))
	l.sort()
	while True:
		if 2048 in l:
			print("YES")
			break
		if len(l) == 0:
			print("NO")
			break
		if len(l) > 1 and l[0] == l[1]:
			l = [2*l[0]] + l[2:]
		else:
			l = l[1:]
		l.sort()


t = int(input())

for _ in range(t):
 _ = input()
 L = [int(x) for x in input().split() if int(x) <= 2048]
 print("YES" if sum(L) >= 2048 else "NO")

import collections

def solve():
    n = int(input())
    a = list(map(int, input().split()))
    d = collections.defaultdict(int)
    for i in a:
        d[i] += 1
    for i in range(11):
        d[2 ** (i + 1)] += d[2 ** i] // 2

    if d[2 ** 11]:
        print('YES')
    else:
        print('NO')

t = int(input())

for _ in range(t):
    solve()



q=int(input())
for t in range(q):
      n=int(input())
      l=list(map(int,input().split()))
      tot=0
      for i in range(n):
            if(l[i]<=2048):
                  tot+=l[i]
      if(tot>=2048):
            print("YES")
      else:
            print("NO")


tgt = (2048).bit_length() - 1
for _ in range(int(input())):
    n = int(input())
    c = [0] * 31
    for x in input().split():
        c[int(x).bit_length() - 1] += 1
    for i in range(tgt):
        c[i + 1] += c[i] // 2
    print('YES' if c[tgt] else 'NO')

T = int(input())

while T > 0:
    T -= 1
    n = int(input())
    A = map(int, input().split())

    cnt = [0] * 40

    for i in A:
        pw = 0
        while i > 1:
            i //= 2
            pw += 1
        cnt[pw] += 1
    
    for i in range(12):
        cnt[i+1] += cnt[i] // 2

    if cnt[11] > 0:
        print("YES")
    else:
        print("NO")

q = int(input())
for i in range(q):
    n = int(input())
    s1 = list(map(int,input().split()))
    s1.sort()
    num = 0
    for i in s1:
        if i > 2048:
            break
        num += i
    if num >= 2048:
        print("YES")
    else:
        print("NO")


q = int(input())
for _ in range(q):
    n = int(input())
    s = list(map(int, input().split()))
    beki = [0]*50
    for i in range(n):
        beki[s[i].bit_length()-1] += 1

    for i in range(29):
        beki[i+1] += beki[i]//2

    if beki[11] > 0:
        print("YES")
    else:
        print("NO")


for _ in range(int(input())):
    n = int(input())
    S = [d for d in map(int, input().split()) if d <= 2048]
    if sum(S) >= 2048:
        print("YES")
    else:
        print("NO")

for _ in range(int(input())):
    n = int(input())
    l = [int(i) if int(i) <= 2048 else 0 for i in input().split()]
    if(sum(l)>=2048):
        print("YES")
    else:
        print("NO")

t = int(input())
for _ in range(t):
    input()
    s = [int(x) for x in input().split()]
    mysum = sum([x for x in s if x <= 2048])
    print("YES" if mysum >= 2048 else "NO")



from sys import stdin
q=int(stdin.readline().strip())
for i in range(q):
    n=int(stdin.readline().strip())
    s=list(map(int,stdin.readline().strip().split()))
    flag=False
    for j in range(12):
        
        x=2**j

        s1=[]
        cnt=0
        for k in range(len(s)):
            if s[k]==x:
                cnt+=1
            else:
                s1.append(s[k])
            if s[k]==2048:
                flag=True
        y=cnt//2
        s1=s1+[x*2]*y
        s=s1.copy()
    if flag:
        print("YES")
    else:
        print("NO")


for _ in range(int(input())):
    N = int(input())
    num = list(map(int, input().split()))
    num.sort(reverse=True)
    x = 0
    ans = 'NO'
    for k in num:
        if k > 2048: continue
        else: x += k
        if x == 2048: ans = 'YES'
    print(ans)

Q = int(input())

def solve():
    N = int(input())
    S = list(map(int, input().split()))
    S = sorted(S)

    while len(S) > 1:
        if S[0] == 2048:
            return True

        if S[0] == S[1]:
            S = [2*S[0]] + S[2:]
        else:
            S = S[1:]
        S = sorted(S)
        
    return 2048 in S
    

for _ in range(Q):
    if solve():
        print("YES")
    else:
        print("NO")