#include #include using namespace std; using ll = long long; ll h; using S = array; using F = ll; constexpr S e(){return S({0, 1ll << 60, 0, 0});} constexpr S op(S l, S r){ l[0] = max(l[0], r[0]); l[1] = min(l[1], r[1]); l[2] += r[2], l[3] += r[3]; return l; } S mapping(F f, S x){ x[0] += f; x[1] += f; if(x[1] < h) return x; x[3] = x[2]; return x; } constexpr F composition(F f, F g){return f + g;} constexpr F id(){return 0;} int main(){ ios::sync_with_stdio(false); cin.tie(0); int n, w, v, a, b, x; cin >> n >> w >> h; atcoder::lazy_segtree seg(vector(w, S({0, 0, 1, 0}))); ll ans = 0, pre = 0; for(int i = 0; i < n; i++){ cin >> a >> b >> x; x--; seg.apply(x, x + a, b); auto tmp = seg.all_prod(); ll d = tmp[3] - pre; pre = tmp[3]; ans += (i & 1 ? -d : d); if(tmp[3] >= w) break; } cout << (ans == 0 ? "DRAW" : ans > 0 ? "A" : "B") << '\n'; }