#include <stdio.h>
int n,A[50];
int solve(int x, int y);
int main(){
    int i,a,b;
    scanf("%d",&n);
    for(i=0;i<n;i++){
          scanf("%d",&A[i]);
          scanf("%d",&a);
    }
    for(i=0;i<a;i++){
        scanf("%d",&b);
        if(solve(0,b)){
            printf("yes\n");
        }
        else printf("no\n");
    }
    return 0;
}
int solve(int x, int y)
{
    if(y==0)return 1;
    if(x>=n)return 0;
    int c=solve(x+1,y) || solve(x+1,y-A[x]);
    return c;
}
