using System; using static System.Console; using System.Linq; using System.Collections.Generic; class Program { static int NN => int.Parse(ReadLine()); static long[] NList => ReadLine().Split().Select(long.Parse).ToArray(); static string[] SList(long n) => Enumerable.Repeat(0, (int)n).Select(_ => ReadLine()).ToArray(); public static void Main() { Solve(); } static void Solve() { var c = NList; var (n, w, h) = (c[0], (int)c[1], c[2]); var init = new long[w]; var seg = new AtCoder.LazySegtree(init); var apt = 0; var bpt = 0; for (var i = 0; i < n; ++i) { c = NList; var (a, b, x) = ((int)c[0], (int)c[1], (int)c[2] - 1); var height = seg.Prod(x, x + a) + b; seg.Apply(x, x + a, height); while (true) { var pos = seg.MaxRight(x, hi => hi < h); if (pos >= x + a) break; if (i % 2 == 0) ++apt; else ++bpt; seg[pos] = INF; } } WriteLine(apt == bpt ? "DRAW" : apt > bpt ? "A" : "B"); } static long INF = long.MinValue + 1; struct SegOp : AtCoder.ILazySegtreeOperator { public long Identity => long.MinValue; public long FIdentity => long.MinValue; public long Composition(long nf, long cf) { if (nf == FIdentity || cf == INF) return cf; return nf; } public long Mapping(long f, long x) { if (f == FIdentity || x == INF) return x; return f; } public long Operate(long x, long y) { return Math.Max(x, y); } } }