#include using namespace std; #define int long long #define REP(i,n) for(int i = 0;i < (int)(n);i++) #define RREP(i,n) for(int i = (int)n-1;i >= 0;i--) #define FOR(i,s,n) for(int i = s;i < (int)n;i++) #define RFOR(i,s,n) for(int i = (int)n-1;i >= s;i--) #define ALL(a) a.begin(),a.end() #define IN(a, x, b) (a<=x && xinline bool CHMAX(T&a,T b){if(ainline bool CHMIN(T&a,T b){if(a>b){a = b;return true;}return false;} constexpr long long INF = 1e18; signed main(){ int N,M; cin>>N>>M; vector>q[N+2]; mapmp; mp['Y']=0; mp['K']=1; mp['C']=2; REP(i,M){ int l,r; char c; cin>>l>>r>>c; q[l-1].push_back({i+1,mp[c]}); q[r].push_back({-i-1,mp[c]}); } set>st; vectorans(N,-1); REP(i,N){ for(auto e:q[i]){ int t = e.first; int c = e.second; if(t > 0){ st.insert({t,c}); }else{ st.erase({-t,c}); } } if(st.begin()==st.end())continue; ans[i]=st.begin()->second; } vectorcnt(3,0); REP(i,N)if(ans[i]!=-1)cnt[ans[i]]++; REP(i,cnt.size())cout << cnt[i] << " \n"[i+1 == cnt.size()]; }