#include<stdio.h>

#define N 20
#define Q 200
 
int answer(int,int);
 
int A[N],M[Q];
int count,n;
 
int main(){
  int x,i;
   
  scanf("%d", &n);
  for( i = 0; i < n; i++ ){
    scanf("%d", &A[i]);
    scanf("%d", &x);
  } 

  for( i = 0; i < x; i++ ){
    scanf("%d", &M[i]);
  }
  
  for(i=0;i<x;i++){
    count=0;
    if(answer(0,M[i])==1){
      printf("yes\n");
    }
    else printf("no\n");
  }
  return 0;

}
 
int answer(int i,int m){
  if(i<n && count==0 && m>0){
    if(A[i] == m){
      count++;
      return 1;
    }

  answer(i+1,m-A[i]);
  answer(i+1,m);
  }
}