output_description: For each question _M i_, print yes or no.
input_description: In the first line _n_ is given. In the second line, _n_ integers are given. In
  the third line _q_ is given. Then, in the fourth line, _q_ integers (_M i_)
  are given.
attempt: import sys
  #fin = open("test.txt", "r")
  fin = sys.stdin
  
  n = int(fin.readline())
  A = list(map(int, fin.readline().split()))
  q = int(fin.readline())
  m_list = list(map(int, fin.readline().split()))
  
  for m in m_list:
  	can_compose = False
  	s = [[] for i in range(n)] #s[i][m]??§???A[i]?????§???????´???§m????????????????????????????????????
  	for i in range(n):
  		s[i] = [False for i in range(m + 1)]
  
  	for j in range(m + 1):
  		if j == A[0]:
  			s[0][j] = True
  		else:
  			s[0][j] = False
  		
  	if s[0][m]:
  		can_compose = True
  		
  	if not can_compose:
  		for i in range(1, n):
  			for j in range(m + 1):
  				if j == A[i]:
  					s[i][j] = True
  				elif s[i - 1][j]:
  					s[i][j] = True
  				else:
  					if j - A[i] >= 0:
  						s[i][j] = s[i - 1][j - A[i]]
  			
  			if s[i][m]:
  				can_compose = True
  				break
  
  	if can_compose:
  		print("yes")
  	else:
  		print("no")
problem_description: Exhaustive Search
  
  Write a program which reads a sequence _A_ of _n_ elements and an integer _M_
  , and outputs "yes" if you can make _M_ by adding elements in _A_ , otherwise
  "no". You can use an element only once.
  
  You are given the sequence _A_ and _q_ questions where each question contains
  _M i_.
samples: [{"input": "5\n    1 5 7 10 21\n    8\n    2 4 17 8 22 21 100 35", "output": "no\n    no\n    yes\n    yes\n    yes\n    yes\n    no\n    no"}]