#include using namespace std; int main() { int n, m; cin >> n >> m; vector l(m), r(m); vector t(m), s(n); for (int i = 0; i < m; i++) { cin >> l.at(i) >> r.at(i) >> t.at(i); l.at(i)--; } reverse(l.begin(), l.end()); reverse(r.begin(), r.end()); reverse(t.begin(), t.end()); for (int i = 0; i < m; i++) { for (int j = l.at(i); j < r.at(i); j++) { s.at(j) = t.at(i); } } int y = 0, k = 0, c = 0; for (char x : s) { switch (x) { case 'Y': y++; break; case 'K': k++; break; case 'C': c++; break; } } cout << y << " " << k << " " << c << endl; }