#include using namespace std; #define rep(i, n) for (int i = 0; i < (n); i++) typedef long long ll; typedef pair pii; typedef vector vll; typedef vector vi; typedef vector> vvi; typedef vector> vvll; const ll inf = 1e16; const ll md = 1000000007; int main() { int n,m; cin>>n>>m; priority_queue q; priority_queue cmd; map ttoi{{'Y',0},{'K',1},{'C',2}}; vi ans(3,0); rep(i,m){ int l,r; char t; cin>>l>>r>>t; l--;r--; cmd.push({-l,-i,r,ttoi[t]}); } rep(di,n){ while(cmd.size()>0 && -cmd.top()[0]<=di){ q.push({cmd.top()[1],cmd.top()[2],cmd.top()[3]}); cmd.pop(); } if(q.size()>0) ans[q.top()[2]]++; while(q.size()>0 && q.top()[1]<=di) q.pop(); } cout<