#include #define int long long #define all(v) v.begin(),v.end() #define rall(v) v.rbegin(),v.rend() using namespace std; templateistream&operator>>(istream&I,vector&v){for(auto&i:v)I>>i;return I;} templateostream&operator<<(ostream&O,vector&v){for(auto&i:v)O<=h){ mx[o]=-1e18; if(tu)A++; else B++; } return; } pushdown(o); int mid=(l+r)>>1; if(mx[o<<1]>=h)get(l,mid,o<<1); if(mx[o<<1|1]>=h)get(mid+1,r,o<<1|1); mx[o]=max(mx[o<<1],mx[o<<1|1]); } void upd(int l,int r,int o,int L,int R,int z){ if(l>=L&&r<=R){ mx[o]+=z; add[o]+=z; if(mx[o]>=h)get(l,r,o); return; } pushdown(o); int mid=(l+r)>>1; if(L<=mid)upd(l,mid,o<<1,L,R,z); if(R>mid)upd(mid+1,r,o<<1|1,L,R,z); mx[o]=max(mx[o<<1],mx[o<<1|1]); } void solve(){ cin>>T>>n>>h; while(T--){ tu^=1; int a,b,x; cin>>a>>b>>x; upd(1,n,1,x,a+x-1,b); } if(A>B)cout<<"A"; else if(A>t; while(t--)AC::solve(); }