All Submissions


Problem Statement

BIT Mesra is a place which is never short of exciting activities going around in the campus.
Recently a huge fight has been going on between the ACM and the NON ACM Members. But don't worry , this fight is not physical in nature. Infact in this fight the two groups want to establish their intellectual superiority over each other. However, the VC got really worried with the development of events and wants to resolve this issue once and forever.

VC first selects one representative from both the groups and makes them play a game. The group whose member will win the game will be accepted as the intellectually superior group. The rules of the game are given below.

There are N stones in a row, all of which are black except for the M-th one, which is white (all indexes in this probem begin from 1). The players alternate turns, and ACM representative plays first. On each turn, a player must choose exactly K consecutive stones, one of which must be white, and reverse their order. The winner is the first player who puts
the white stone in the L-th position. Print ACM if ACM representative can win regardless of how NON ACM representative plays, and print NONACM if NON ACM representative can win regardless of ACM representative's strategy. Otherwise, return DRAW since neither player can win if both players play optimally.

INPUT

The first line of input contains an integer t<=200, the number of test cases. Then t test
cases follow each containing a line with 4 integers N M K L.

2<=N<=1000000

1<=M,K,L<=N

M and L are different

OUTPUT

A single line for each test case (ACM/NONACM/DRAW)

SAMPLE INPUT


3
2 1 2 2
3 1 1 2
5 5 2 3


SAMPLE OUTPUT


ACM
DRAW
NONACM


Problem Setter: Md Taha Bin Jawaid (TBJ)

Languages: C,C++,C#,Java,JavaScript,Pascal,Perl,PHP,Python,Ruby

Time Limit: 1 Second(s)
Score: 100 Point(s)
Input File Limit: 50000 Bytes

Submit

Login to post clarification.

No Clarifications.

Contest

Mode Judge

Passive

Online

Overall Rankings

RankNameScore
1xyz0
2Ams0
3TIP0
4team420
5xyzz0
6asdasdasd0
7abcd0
8khankhan0
9Gabriel0
10gigel0