#!/usr/bin/ python3.8 import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines class BinaryIndexedTree(): def __init__(self, seq): self.size = len(seq) self.depth = self.size.bit_length() self.build(seq) def build(self, seq): data = seq size = self.size for i, x in enumerate(data): j = i + (i & (-i)) if j < size: data[j] += data[i] self.data = data def __repr__(self): return self.data.__repr__() def get_sum(self, i): data = self.data s = 0 while i: s += data[i] i -= i & -i return s def add(self, i, x): data = self.data size = self.size while i < size: data[i] += x i += i & -i def find_kth_element(self, k): data = self.data size = self.size x, sx = 0, 0 dx = 1 << (self.depth) for i in range(self.depth - 1, -1, -1): dx = (1 << i) if x + dx >= size: continue y = x + dx sy = sx + data[y] if sy < k: x, sx = y, sy return x + 1 N, W, H = map(int, readline().split()) m = map(int, read().split()) query = tuple(zip(m, m, m)) left = [0] * (W + 1) # 終わっていない right = [0] + [N] * (W) # 終わっている while True: tasks = [[] for _ in range(N + 1)] # 時刻ごとの調べる座標 update = False for i, (x, y) in enumerate(zip(left, right)): if x + 1 < y: z = (x + y) // 2 tasks[z].append(i) update = True if not update: break bit = BinaryIndexedTree([0] * (W + 2)) for t, (a, b, x) in enumerate(query, 1): bit.add(x, b) bit.add(x + a, -b) for w in tasks[t]: if H <= bit.get_sum(w): right[w] = t else: left[w] = t A = sum(x & 1 for x in right[1:]) B = W - A print('A' if A > B else 'B' if B > A else 'DRAW')