#include #include #include #include using namespace std; int main() { int N, M; std::cin >> N >> M; vector> madd(N + 1), mdel(N + 1); for (int t = 0; t < M; t++) { int L, R; char T; cin >> L >> R >> T; int a = 0; if (T == 'K') a = 1; if (T == 'C') a = 2; madd[L - 1].insert(a + t * 3); mdel[R].insert(a + t * 3); } vector ret(3); set s; for (int i = 0; i < N; i++) { s.insert(madd[i].begin(), madd[i].end()); for (auto x : mdel[i]) s.erase(x); if (!s.empty()) ret[*s.begin() % 3]++; } for (auto x : ret) cout << x << " "; }