Buggy python submission (verdict: Runtime Error):
n = int( raw_input() )
A = map( int , raw_input().split() )
q = int( raw_input() )
m = map( int , raw_input().split() )

for i in n-1
  def solve(i, m)
    if m == 0
      return true
    if i >= n
      return false
    res = solve(i + 1, m) || solve(i + 1, m - A[i])
    return res

Fixed submission:
n = input()
A = map( int , raw_input().split() )
q = input()
mi = map( int , raw_input().split() )

def solve(i, m):
  if m == 0:
    return True
  elif i >= n or m > sum(A):
    return False

  res = solve( i+1 , m ) or solve( i+1 , m-A[i] )
  return res

for m in mi:
  if solve( 0 , m ): print "yes"
  else: print "no"

Buggy python submission (verdict: Runtime Error):
n = int( raw_input() )
A = map( int , raw_input().split() )
q = int( raw_input() )
m = map( int , raw_input().split() )

for i in n-1
  def solve(i, m)
    if m == 0
      return true
    if i >= n
      return false
    res = solve( i+1 , m ) || solve( i+1 , m-A[i] )
    return res

Fixed submission:
n = input()
A = map( int , raw_input().split() )
q = input()
mi = map( int , raw_input().split() )

def solve(i, m):
  if m == 0:
    return True
  elif i >= n or m > sum(A):
    return False

  res = solve( i+1 , m ) or solve( i+1 , m-A[i] )
  return res

for m in mi:
  if solve( 0 , m ): print "yes"
  else: print "no"

Buggy python submission (verdict: Runtime Error):
n = int( raw_input() )
A = map( int , raw_input().split() )
q = int( raw_input() )
m = map( int , raw_input().split() )

for i in range( len(A) + 1 ):
  def solve(i, m)
    if m == 0:
      return true
    if i >= n:
      return false
    res = solve( i+1 , m ) | solve( i+1 , m-A[i] )
    return res

Fixed submission:
n = input()
A = map( int , raw_input().split() )
q = input()
mi = map( int , raw_input().split() )

def solve(i, m):
  if m == 0:
    return True
  elif i >= n or m > sum(A):
    return False

  res = solve( i+1 , m ) or solve( i+1 , m-A[i] )
  return res

for m in mi:
  if solve( 0 , m ): print "yes"
  else: print "no"

Buggy python submission (verdict: Runtime Error):
n = int( raw_input() )
A = map( int , raw_input().split() )
q = int( raw_input() )
m = map( int , raw_input().split() )

for i in range( len(A) + 1 ):
  def solve(i, m)
    if m == 0:
      return yes
    if i >= n:
      return no
    res = solve( i+1 , m ) | solve( i+1 , m-A[i] )
    return res

Fixed submission:
n = input()
A = map( int , raw_input().split() )
q = input()
mi = map( int , raw_input().split() )

def solve(i, m):
  if m == 0:
    return True
  elif i >= n or m > sum(A):
    return False

  res = solve( i+1 , m ) or solve( i+1 , m-A[i] )
  return res

for m in mi:
  if solve( 0 , m ): print "yes"
  else: print "no"

Buggy python submission (verdict: Runtime Error):
n = int( raw_input() )
A = map( int , raw_input().split() )
q = int( raw_input() )
m = map( int , raw_input().split() )

for i in range( len(A) + 1 ):
  def solve(i, m)
    if m == 0:
      return yes
    if i >= n:
      return no
    res = solve( i+1 , m ) | solve( i+1 , m-A[i] )
    return res

Fixed submission:
n = input()
A = map( int , raw_input().split() )
q = input()
mi = map( int , raw_input().split() )

def solve(i, m):
  if m == 0:
    return True
  elif i >= n or m > sum(A):
    return False

  res = solve( i+1 , m ) or solve( i+1 , m-A[i] )
  return res

for m in mi:
  if solve( 0 , m ): print "yes"
  else: print "no"

Buggy python submission (verdict: Runtime Error):
n = int( raw_input() )
A = map( int , raw_input().split() )
q = int( raw_input() )
m = map( int , raw_input().split() )

for i in range( len(A) + 1 ):
  def solve(i, m)
    if m == 0:
      return yes
    if i >= n:
      return no
    res = solve( i+1 , m ) | solve( i+1 , m-A[i] )
    return res

Fixed submission:
n = input()
A = map( int , raw_input().split() )
q = input()
mi = map( int , raw_input().split() )

def solve(i, m):
  if m == 0:
    return True
  elif i >= n or m > sum(A):
    return False

  res = solve( i+1 , m ) or solve( i+1 , m-A[i] )
  return res

for m in mi:
  if solve( 0 , m ): print "yes"
  else: print "no"

Buggy python submission (verdict: Runtime Error):
n = int( raw_input() )
A = map( int , raw_input().split() )
q = int( raw_input() )
m = map( int , raw_input().split() )

for i in range( len(A) + 1 ):
  def solve(i, m)
    if m == 0 or solve( i+1 , m ) or solve( i+1 , m-A[i] ):
      return yes
    if i >= n or m < 0:
      return no
   

Fixed submission:
n = input()
A = map( int , raw_input().split() )
q = input()
mi = map( int , raw_input().split() )

def solve(i, m):
  if m == 0:
    return True
  elif i >= n or m > sum(A):
    return False

  res = solve( i+1 , m ) or solve( i+1 , m-A[i] )
  return res

for m in mi:
  if solve( 0 , m ): print "yes"
  else: print "no"

Buggy python submission (verdict: Runtime Error):
n = int( raw_input() )
A = map( int , raw_input().split() )
q = int( raw_input() )
m = map( int , raw_input().split() )

for i in range( len(A) + 1 ):
  def solve(i, m)
    if m == 0 or solve( i+1 , m ) or solve( i+1 , m-A[i] ):
      print 'yes'
    if i >= n or m < 0:
      print 'no'


   

Fixed submission:
n = input()
A = map( int , raw_input().split() )
q = input()
mi = map( int , raw_input().split() )

def solve(i, m):
  if m == 0:
    return True
  elif i >= n or m > sum(A):
    return False

  res = solve( i+1 , m ) or solve( i+1 , m-A[i] )
  return res

for m in mi:
  if solve( 0 , m ): print "yes"
  else: print "no"

Buggy python submission (verdict: Runtime Error):
n = int( raw_input() )
A = map( int , raw_input().split() )
q = int( raw_input() )
mi = map( int , raw_input().split() )

for i in range( len(A) + 1 ):
  def solve(i, m)
    if m == 0:
      return True
    if i >= n:
      return False
  res = solve( i+1 , m ) or solve( i+1 , m-A[i] )
  return res

for m in mi
  if solve( 0 , m ):
    print 'yes'
  else:
    print 'no'
   

Fixed submission:
n = input()
A = map( int , raw_input().split() )
q = input()
mi = map( int , raw_input().split() )

def solve(i, m):
  if m == 0:
    return True
  elif i >= n or m > sum(A):
    return False

  res = solve( i+1 , m ) or solve( i+1 , m-A[i] )
  return res

for m in mi:
  if solve( 0 , m ): print "yes"
  else: print "no"

Buggy python submission (verdict: Runtime Error):
n = int( raw_input() )
A = map( int , raw_input().split() )
q = int( raw_input() )
mi = map( int , raw_input().split() )

for i in range( len(A) + 1 ):
  def solve(i, m)
    if m == 0:
      return True
    if i >= n:
      return False
  res = solve( i+1 , m ) or solve( i+1 , m-A[i] )
  return res

for m in mi
  if solve( 0 , m ):
    print 'yes'
  else:
    print 'no'
   

Fixed submission:
n = input()
A = map( int , raw_input().split() )
q = input()
mi = map( int , raw_input().split() )

def solve(i, m):
  if m == 0:
    return True
  elif i >= n or m > sum(A):
    return False

  res = solve( i+1 , m ) or solve( i+1 , m-A[i] )
  return res

for m in mi:
  if solve( 0 , m ): print "yes"
  else: print "no"

Buggy python submission (verdict: Runtime Error):
n = input()
A = map( int , raw_input().split() )
q = input()
mi = map( int , raw_input().split() )

def solve(i, m)
  if m == 0:
    return True
  if i >= n:
    return False
res = solve( i+1 , m ) or solve( i+1 , m-A[i] )
return res

for m in mi
  if solve( 0 , m ):
    print 'yes'
  else:
    print 'no'
   

Fixed submission:
n = input()
A = map( int , raw_input().split() )
q = input()
mi = map( int , raw_input().split() )

def solve(i, m):
  if m == 0:
    return True
  elif i >= n or m > sum(A):
    return False

  res = solve( i+1 , m ) or solve( i+1 , m-A[i] )
  return res

for m in mi:
  if solve( 0 , m ): print "yes"
  else: print "no"

Buggy python submission (verdict: Runtime Error):
n = input()
A = map( int , raw_input().split() )
q = input()
mi = map( int , raw_input().split() )

def solve(i, m):
  if m == 0:
    return True
  if i >= n:
    return False
res = solve( i+1 , m ) or solve( i+1 , m-A[i] )
return res

for m in mi:
  if solve( 0 , m ):
    print 'yes'
  else:
    print 'no'
   

Fixed submission:
n = input()
A = map( int , raw_input().split() )
q = input()
mi = map( int , raw_input().split() )

def solve(i, m):
  if m == 0:
    return True
  elif i >= n or m > sum(A):
    return False

  res = solve( i+1 , m ) or solve( i+1 , m-A[i] )
  return res

for m in mi:
  if solve( 0 , m ): print "yes"
  else: print "no"

Buggy python submission (verdict: Runtime Error):
n = int( raw_input() )
A = map( int , raw_input().strip().split(' ') )
q = int( raw_input() )
mi = map( int , raw_input().strip().split(' ') )

def solve(i, m):
  if m == 0:
    return True
  if i >= n:
    return False
res = solve( i+1 , m ) or solve( i+1 , m-A[i] )
return res

for m in mi:
  if solve( 0 , m ):
    print 'yes'
  else:
    print 'no'
   

Fixed submission:
n = input()
A = map( int , raw_input().split() )
q = input()
mi = map( int , raw_input().split() )

def solve(i, m):
  if m == 0:
    return True
  elif i >= n or m > sum(A):
    return False

  res = solve( i+1 , m ) or solve( i+1 , m-A[i] )
  return res

for m in mi:
  if solve( 0 , m ): print "yes"
  else: print "no"

Buggy python submission (verdict: Runtime Error):
n = int( raw_input() )
A = map( int , raw_input().strip().split(' ') )
q = int( raw_input() )
mi = map( int , raw_input().strip().split(' ') )

def solve(i, m):
  if m == 0:
    return True
  if i >= n:
    return False
res = solve( i+1 , m ) | solve( i+1 , m-A[i] )
return res

for m in mi:
  if solve( 0 , m ):
    print 'yes'
  else:
    print 'no'
   

Fixed submission:
n = input()
A = map( int , raw_input().split() )
q = input()
mi = map( int , raw_input().split() )

def solve(i, m):
  if m == 0:
    return True
  elif i >= n or m > sum(A):
    return False

  res = solve( i+1 , m ) or solve( i+1 , m-A[i] )
  return res

for m in mi:
  if solve( 0 , m ): print "yes"
  else: print "no"

Buggy python submission (verdict: Time Limit Exceeded):
n = int( raw_input() )
A = map( int , raw_input().strip().split(' ') )
q = int( raw_input() )
mi = map( int , raw_input().strip().split(' ') )

def solve(i, m):
  if m == 0:
    return True
  elif i >= n:
    return False
  else:
    res = solve( i+1 , m ) | solve( i+1 , m-A[i] )
    return res

for m in mi:
  if solve( 0 , m ):
    print 'yes'
  else:
    print 'no'
   

Fixed submission:
n = input()
A = map( int , raw_input().split() )
q = input()
mi = map( int , raw_input().split() )

def solve(i, m):
  if m == 0:
    return True
  elif i >= n or m > sum(A):
    return False

  res = solve( i+1 , m ) or solve( i+1 , m-A[i] )
  return res

for m in mi:
  if solve( 0 , m ): print "yes"
  else: print "no"

Buggy python submission (verdict: Time Limit Exceeded):
n = int( raw_input() )
A = map( int , raw_input().strip().split(' ') )
q = int( raw_input() )
mi = map( int , raw_input().strip().split(' ') )

def solve(i, m):
  if m == 0:
    return True
  elif i >= n:
    return False
  else:
    res = solve( i+1 , m ) | solve( i+1 , m-A[i] )
    return res

for m in mi:
  if solve( 0 , m ): print "yes"
  else: print "no"
   

Fixed submission:
n = input()
A = map( int , raw_input().split() )
q = input()
mi = map( int , raw_input().split() )

def solve(i, m):
  if m == 0:
    return True
  elif i >= n or m > sum(A):
    return False

  res = solve( i+1 , m ) or solve( i+1 , m-A[i] )
  return res

for m in mi:
  if solve( 0 , m ): print "yes"
  else: print "no"

Buggy python submission (verdict: Time Limit Exceeded):
n = int( raw_input() )
A = map( int , raw_input().strip().split(' ') )
q = int( raw_input() )
mi = map( int , raw_input().strip().split(' ') )

def solve(i, m):
  if m == 0:
    return True
  elif i >= n:
    return False
  else:
    res = solve( i+1 , m ) | solve( i+1 , m-A[i] )
    return res

for m in mi:
  if solve( 0 , m ): print "yes"
  else: print "no"
   

Fixed submission:
n = input()
A = map( int , raw_input().split() )
q = input()
mi = map( int , raw_input().split() )

def solve(i, m):
  if m == 0:
    return True
  elif i >= n or m > sum(A):
    return False

  res = solve( i+1 , m ) or solve( i+1 , m-A[i] )
  return res

for m in mi:
  if solve( 0 , m ): print "yes"
  else: print "no"

Buggy python submission (verdict: Runtime Error):
n = input()
A = map( int , raw_input().split() )
q = input()
M = map( int , raw_input().split() )

def solve(i, m):
  if m == 0:
    return True
  elif i >= n:
    return False
  else:
    res = solve( i+1 , m ) | solve( i+1 , m-A[i] )
    return res

for m in mi:
  if solve( 0 , m ): print "yes"
  else: print "no"
   

Fixed submission:
n = input()
A = map( int , raw_input().split() )
q = input()
mi = map( int , raw_input().split() )

def solve(i, m):
  if m == 0:
    return True
  elif i >= n or m > sum(A):
    return False

  res = solve( i+1 , m ) or solve( i+1 , m-A[i] )
  return res

for m in mi:
  if solve( 0 , m ): print "yes"
  else: print "no"

Buggy python submission (verdict: Time Limit Exceeded):
n = input()
A = map( int , raw_input().split() )
q = input()
mi = map( int , raw_input().split() )

def solve(i, m):
  if m == 0:
    return True
  elif i >= n:
    return False
  else:
    res = solve( i+1 , m ) | solve( i+1 , m-A[i] )
    return res

for m in mi:
  if solve( 0 , m ): print "yes"
  else: print "no"
   

Fixed submission:
n = input()
A = map( int , raw_input().split() )
q = input()
mi = map( int , raw_input().split() )

def solve(i, m):
  if m == 0:
    return True
  elif i >= n or m > sum(A):
    return False

  res = solve( i+1 , m ) or solve( i+1 , m-A[i] )
  return res

for m in mi:
  if solve( 0 , m ): print "yes"
  else: print "no"