#include using namespace std; const int W = 1e5 + 5; int n, w, score[2]; long long h, tree[4 * W]; void update (int l, int r, int s, int t, int k, int x) { if (s == t) { tree[x] += k; return; } int mid = (s + t) / 2; if (l <= mid) update (l, r, s, mid, k, x * 2); if (r > mid) update (l, r, mid + 1, t, k, x * 2 + 1); tree[x] = max(tree[2 * x], tree[2 * x + 1]); } int query (int l, int r, int s, int t, int x) { if (s == t) { tree[x] = -1e9; return 1; } int ans = 0, mid = (s + t) / 2; if (l <= mid && tree[x * 2] >= h) ans += query (l, r, s, mid, x * 2); if (r > mid && tree[x * 2 + 1] >= h) ans += query (l, r, mid + 1, t, x * 2 + 1); return ans; } signed main() { //freopen ("game.in", "r", stdin); //freopen ("game.out", "w", stdout); scanf ("%d%d%lld", &n, &w, &h); for (int i = 1; i <= n; i++) { int a, b, x; scanf ("%d%d%d", &a, &b, &x); if (score[0] + score[1] == w) break; update (x, a + x - 1, 1, w, b, 1); score[i % 2] += query (x, a + x - 1, 1, w, 1); } /*if (score[1] > score[0]) printf ("A\n%d %d", score[1], score[0]); else if (score[1] < score[0]) printf ("B\n%d %d", score[1], score[0]); else printf ("DRAW\n%d %d", score[1], score[0]);*/ if (score[1] > score[0]) printf ("A"); else if (score[1] < score[0]) printf ("B"); else printf ("DRAW"); return 0; }