#include using namespace std; namespace { int n; int w; int h; int T[ 100010 ]; int R[ 100010 ]; int a; int b; int x; } int main( int argc, char *argv[] ) { int i; int j; int iA; int iB; int iCnt; // ε…₯εŠ› cin >> n; cin >> w; cin >> h; iA = 0; iB = 0; iCnt = w; for( i = 0; i < n; i++ ) { cin >> a; cin >> b; cin >> x; for( j = 0; j < a; j++ ) { if( R[ j + x ] == 0 ) { T[ j + x ] += b; if( T[ j + x ] >= h ) { if( i % 2 == 0 ) { iA++; R[ j + x ] = 1; } else { iB++; R[ j + x ] = 2; } iCnt--; if( iCnt == 0 ) break; } } } if( iCnt == 0 ) break; } // ε‡ΊεŠ› if( iA > iB ) cout << "A" << endl; else if( iA < iB ) cout << "B" << endl; else cout << "DRAW" << endl; return 0; }