시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
1.5 초 512 MB 9 7 7 87.500%

문제

Two intervals of positive integers {a, a + 1, . . . , b} and {c, c + 1, . . . , d} are given. Determine whether the product c·(c+1)· · · d is divisible by the product a·(a+1)· · · b.

입력

The first line contains a single integer t (1 ≤ t ≤ 10), the number of independent test cases.

Each of the following t lines contains four positive integers ai, bi, ci, di (1 ≤ ai ≤ bi ≤ 107, 1 ≤ ci ≤ di ≤ 107).

출력

Output t lines in total. For the i-th test case, output DA (Croatian for yes) if ai · (ai + 1) · · · bi divides ci · (ci + 1)· · · di, and output NE (Croatian for no) otherwise.

예제 입력 1

2
9 10 3 6
2 5 7 9

예제 출력 1

DA
NE

예제 입력 2

6
1 2 3 4
1 4 2 3
2 3 1 4
1 3 2 4
19 22 55 57
55 57 19 22

예제 출력 2

DA
NE
DA
DA
DA
DA

힌트

We have 9 · 10 = 90 and 3 · 4 · 5 · 6 = 360. The answer is DA because 90 divides 360.

We calculate 2 · 3 · 4 · 5 = 120, which doesn’t divide 7 · 8 · 9 = 504. Thus the second answer is NE.