#include using namespace std; using ll = long long; int main(){ ios::sync_with_stdio(false); cin.tie(0); int n, m, l, r; char c; cin >> n >> m; vector tmp(n + 1), ans(n); iota(tmp.begin(), tmp.end(), 1); set S{tmp.begin(), tmp.end()}; auto f = [&](char c){ if(c == 'Y') return 0; return c == 'K' ? 1 : 2; }; while(m--){ cin >> l >> r >> c; auto it = S.lower_bound(l); int cn = f(c); while(*it <= r){ ans[cn]++; S.erase(it++); } } cout << ans[0] << ' ' << ans[1] << ' ' << ans[2] << '\n'; }