You are given a balance scale and several weights. For each given marble, determine whether its weight can be checked using only those weights.
For example, suppose there are two weights, 1 g and 4 g. If a marble and the 1 g weight are placed on opposite pans and the scale balances, then the marble weighs 1 g. To check whether another marble weighs 4 g, place the 4 g weight on the opposite pan instead.
If the marble weighs 3 g, the scale can balance as in Figure 1 by placing the marble and the 1 g weight on one pan and the 4 g weight on the other pan. Therefore, with one 1 g weight and one 4 g weight, a 3 g marble can also be checked.

Using the arrangement in Figure 2, a 5 g marble can also be checked. However, a 2 g marble cannot be checked with the given weights.
Given the weights and the marbles to check, write a program that determines whether each marble's weight can be checked using only the given weights.

The first line contains the number of weights. The number of weights is at most 30.
The second line contains the weights in increasing order. The same weight may appear more than once. Each weight is a natural number not greater than 500, and adjacent values are separated by one space.
The third line contains the number of marbles whose weights must be checked. The number of marbles is at most 7.
The fourth line contains the marble weights to check. Each marble weight is a natural number not greater than 40,000, and adjacent values are separated by one space.
For each marble, output Y if its weight can be checked and N otherwise. Print all answers on one line, separated by single spaces.