#include #include using namespace std; int main(){ cin.tie(0); ios::sync_with_stdio(false); int n, m, ans[3] = {}; cin >> n >> m; set s; while(n > 0) s.insert(n--); while(m--){ int l, r; char c; cin >> l >> r >> c; int ind = c=='Y' ? 0 : c=='K' ? 1 : 2; for(auto it = s.lower_bound(l); it != s.end() && *it <= r;){ ans[ind]++; it = s.erase(it); } } for(int i = 0; i < 3; i++) cout << ans[i] << " \n"[i==2]; return 0; }