#include using namespace std; int main() { cin.tie(nullptr); ios::sync_with_stdio(false); int n, m; cin >> n >> m; set se; for (int i = 0; i < n; ++i) { se.insert(i); } string s(n, '?'); while (m--) { int l, r; char c; cin >> l >> r >> c; --l; auto it = se.lower_bound(l); while (it != end(se) and *it < r) { s[*it] = c; it = se.erase(it); } } string t = "YKC"; for (int k = 0; k < 3; ++k) { cout << count(begin(s), end(s), t[k]) << " \n"[k == 2]; } }