#include using namespace std; using ll = long long; #define rep(i, n) for (int i = 0; i < (n); i++) #define repr(i, n) for (int i = (n) - 1; i >= 0; i--) #define repe(i, l, r) for (int i = (l); i < (r); i++) #define reper(i, l, r) for (int i = (r) - 1; i >= (l); i--) #define repi(i, l, r) for (int i = (l); i <= (r); i++) #define repir(i, l, r) for (int i = (r); i >= (l); i--) #define range(a) a.begin(), a.end() void initio() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); } int main() { initio(); int N, M; cin >> N >> M; vector L(M), R(M); vector T(M); rep(i, M) cin >> L[i] >> R[i] >> T[i]; set st; rep(i, N + 1) st.insert(i); vector color(N, '*'); rep(i, M) { L[i]--; R[i]--; auto it = st.lower_bound(L[i]); while (*it <= R[i]) { color[*it] = T[i]; it = st.erase(it); } } cout << count(range(color), 'Y') << ' '; cout << count(range(color), 'K') << ' '; cout << count(range(color), 'C') << endl; }