#include #include #include #include #include #include #include using namespace std; typedef long long ll; int main(){ ios::sync_with_stdio(false); cin.tie(0); cout << setprecision(10) << fixed; int N, M; cin >> N >> M; set st; int y = 0, k = 0, c = 0; for(int i = 0; i < N; i++){ st.insert(i+1); } for(int i = 0; i < M; i++){ int L, R; char T; cin >> L >> R >> T; auto p = st.lower_bound(L); vector v; for(auto iter = p; iter != st.end() && *iter <= R; iter++){ if(T == 'Y') y++; if(T == 'K') k++; if(T == 'C') c++; v.push_back(*iter); } for(auto iter = v.begin(); iter != v.end(); iter++) st.erase(*iter); } cout << y << ' ' << k << ' ' << c << endl; }