In the event of technical difficulties with Szkopuł, please contact us via email at email@example.com.
If you are familiar with IRC chat, the support team is also reachable on PIRC network (
#szkopul channel. If you are not, just use email.
Please do not ask us things like "how to solve task XYZ?".
Please remember that the support team has to sleep sometimes or go to work in real life.
We are given a set of positive integers . Consider a set of non-negative integers , such that a number belongs to if and only if is a sum of some elements from (the elements may be repeated). For example, if , then sample numbers belonging to the set are: 0 (the sum of 0 elements), 2, 4 and 12 or or ; and the following do not belong to : 1 and 3.
Write a program which:
In the first line there is one integer : the number of elements of the set , . The following lines contain the elements of the set , one per line. In the -st line there is one positive integer , . , .
In the -nd line there is one integer , . Each of the following lines contains one integer in the range from to , they are respectively the numbers .
The output should consist of lines. The -th line should contain the word TAK ("yes" in Polish), if belongs to , and it should contain the word NIE ("no") otherwise.
For the input data:
3 2 5 7 6 0 1 4 12 3 2
the correct result is:
TAK NIE TAK TAK NIE TAK
Task author: Krzysztof Onak.