#include using namespace std::literals::string_literals; using i64 = std::int_fast64_t; using std::cout; using std::endl; using std::cin; template std::vector make_v(size_t a){return std::vector(a);} template auto make_v(size_t a,Ts... ts){ return std::vector(ts...))>(a,make_v(ts...)); } int main() { int n, m; scanf("%d%d", &n, &m); std::vector L(m), R(m); std::vector T(m); std::vector> vec(n); for(int i = 0; i < m; i++) { cin >> L[i] >> R[i] >> T[i]; L[i]--; vec[L[i]].push_back(i); } int Y = 0, K = 0, C = 0; std::priority_queue, std::greater> qu; for(int i = 0; i < n; i++) { while(!qu.empty() and R[qu.top()] <= i) qu.pop(); for(auto id: vec[i]) qu.push(id); if(qu.empty()) continue; Y += (T[qu.top()] == 'Y'); K += (T[qu.top()] == 'K'); C += (T[qu.top()] == 'C'); } printf("%d %d %d\n", Y, K, C); return 0; }