def main():
    import sys
    input = sys.stdin.read().split()
    idx = 0
    n = int(input[idx]); idx +=1
    w = int(input[idx]); idx +=1
    h = int(input[idx]); idx +=1

    # Initialize heights
    heights = [0] * (w + 2)  # 1-based to w
    a_scores = 0
    b_scores = 0
    game_ended = False

    for move in range(n):
        if game_ended:
            break
        a = int(input[idx]); idx +=1
        b = int(input[idx]); idx +=1
        x = int(input[idx]); idx +=1
        L = x
        R = x + a - 1

        player = 'A' if (move % 2 == 0) else 'B'
        current_score = 0

        A = max(0, h - b)
        B = h - 1

        for j in range(L, R+1):
            prev = heights[j]
            if prev < h:
                new = prev + b
                if new >= h:
                    current_score += 1
            heights[j] += b

        if player == 'A':
            a_scores += current_score
        else:
            b_scores += current_score

        # Check if all columns >= h
        all_high = True
        for j in range(1, w+1):
            if heights[j] < h:
                all_high = False
                break
        if all_high:
            game_ended = True

    if a_scores > b_scores:
        print("A")
    elif b_scores > a_scores:
        print("B")
    else:
        print("DRAW")

if __name__ == '__main__':
    main()