#include <stdio.h>

int main(void) {
    int A[20],a[20],m[200],n,i,j,q,ans;
    for (i = 0; i < 20; i++) {
        A[i] = 0;
    }
    scanf("%d",&n);
    for (i = 0;i < n; i++) {
        scanf("%d",&A[i]);
    }
    scanf("%d",&q);
    for (i = 0;i < q; i++) {
        scanf("%d",&m[i]);
    }
    for (i = 0;i < q;i++) {
        for (j = 0;j < 20;j++) {
            a[j] = 0;
        }
        ans = 0;
        for (a[0] = 0;a[0] < 2;a[0]++) {
            for (a[1] = 0;a[1] < 2;a[1]++) {
                for (a[2] = 0;a[2] < 2;a[2]++) {
                    for (a[3] = 0;a[3] < 2;a[3]++) {
                        for (a[4] = 0;a[4] < 2;a[4]++) {
                            for (a[5] = 0;a[5] < 2;a[5]++) {
                                for (a[6] = 0;a[6] < 2;a[6]++) {
                                    for (a[7] = 0;a[7] < 2;a[7]++) {
                                        for (a[8] = 0;a[8] < 2;a[8]++) {
                                            for (a[9] = 0;a[9] < 2;a[9]++) {
                                                for (a[10] = 0;a[10] < 2;a[10]++) {
                                                    for (a[11] = 0;a[11] < 2;a[11]++) {
                                                        for (a[12] = 0;a[12] < 2;a[12]++) {
                                                            for (a[13] = 0;a[13] < 2;a[13]++) {
                                                                for (a[14] = 0;a[14] < 2;a[14]++) {
                                                                    for (a[15] = 0;a[15] < 2;a[15]++) {
                                                                        for (a[16] = 0;a[16] < 2;a[16]++) {
                                                                            for (a[17] = 0;a[17] < 2;a[17]++) {
                                                                                for (a[18] = 0;a[18] < 2;a[18]++) {
                                                                                    for (a[19] = 0;a[19] < 2;a[19]++) {
                                                                                        if (A[0] * a[0] + A[1] * a[1] + A[2] * a[2] + A[3] * a[3] + A[4] * a[4] + A[5] * a[5] + A[6] * a[6] + A[7] * a[7] + A[8] * a[8] + A[9] * a[9] + A[10] * a[10] + A[11] * a[11] + A[12] * a[12] + A[13] * a[13] + A[14] * a[14] + A[15] * a[15] + A[16] * a[16] + A[17] * a[17] +A[18] * a[18] + A[19] * a[19] == m[i]) ans = 1;
                                                                                    }
                                                                                }
                                                                            }
                                                                        }
                                                                    }
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
        if (ans == 1) {
            printf("yes\n");
        } else {
            printf("no\n");
        }
    }
    return 0;
}

Measured memory_bytes: 584