from heapq import * from collections import defaultdict import sys sys.setrecursionlimit(10 ** 6) int1 = lambda x: int(x) - 1 p2D = lambda x: print(*x, sep="\n") def MI(): return map(int, sys.stdin.readline().split()) def LI(): return list(map(int, sys.stdin.readline().split())) def LLI(rows_number): return [LI() for _ in range(rows_number)] def main(): n, m = MI() to = defaultdict(list) ttomark = {"Y": 0, "K": 1, "C": 2} for p in range(m): l, r, t = input().split() l, r = int(l) - 1, int(r) - 1 to[l].append([p, r, ttomark[t]]) hp = [] ans = [0] * 3 for i in range(n): for prm in to[i]: heappush(hp, prm) while hp and hp[0][1] < i: heappop(hp) if not hp:continue ans[hp[0][2]] += 1 print(*ans) main()