#include #define rep(i,n) for(int i=0;i> N >> M; setres; rep(i,N)res.insert(i); vectorans(3,0); rep(i,M){ int L,R;char T; cin >> L >> R >> T; L--;R--; auto itr = lower_bound(res.begin(),res.end(),L); while (itr!=res.end()&&L<=(*itr)&&(*itr)<=R) { itr=res.erase(itr); if(T=='Y')ans[0]++; if(T=='K')ans[1]++; if(T=='C')ans[2]++; } } printf("%lld %lld %lld\n",ans[0],ans[1],ans[2]); return 0; }