#P6320. [COCI 2006/2007 #4] SIBICE

[COCI 2006/2007 #4] SIBICE

Background

Young Mirko throws matches everywhere. His mother wants him to put the matches into a box.

Problem Description

Mirko now needs to put nn matches into a rectangular box of size w×hw \times h.

Now he wants you to determine, for each of the nn matches, whether it can fit into the box.

We can treat the box as a plane; you only need to check whether the match can be placed within this plane.

Input Format

The first line contains three integers n,w,hn, w, h.

The next nn lines each contain an integer in the range [1,1000][1,1000], representing the length of a match.

Output Format

Output nn lines. For each match, output DA if it can fit, otherwise output NE.

5 3 4
3
4
5
6
7 
DA
DA
DA
NE
NE 
2 12 17
21
20 
NE
DA

Hint

Constraints

For 100%100\% of the testdata, it is guaranteed that 1n501 \le n \le 50, 1w,h1001 \le w, h \le 100.

Notes

This problem is translated from COCI2006-2007 CONTEST #4 T1 SIBICE

Translated by ChatGPT 5