Frame paving
Easy
Execution time limit is 1 second
Runtime memory usage limit is 128 megabytes
Frame x * y is rectangle x * y with center rectangle (x - 2) * (y - 2) dropped out. We have many tiles a * 1. Is it possible to cave frame x * y with tiles a * 1?
For example, frame 5 * 6 can be tiled with tiles 3 * 1, but not with tiles 4 * 1.
Input
The first line contains two positive integers x and y (3 ≤ x, y ≤ 10^6
). The second line contains one positive integer n (1 ≤ n ≤ 1000) - number of tile types. The third line contains n positive integers less than 10^6
- lengths of tiles.
Output
Print n lines with YES or NO. i-th line contains YES if it is possible to tile the frame with tiles of i-th type. Output NO otherwise.
Examples
Input #1
Answer #1
Submissions 454
Acceptance rate 31%