import sys input = sys.stdin.readline from heapq import * N, M = map(int, input().split()) ans = [-1] * N C = {"Y":0, "K":1, "C":2} YKC = ["Y", "K", "C"] D = [[] for i in range(N)] for i in range(M): L, R, T = input().split() L, R = int(L) - 1, int(R) - 1 D[L].append((R, C[T], i)) H = [] for i in range(N): for r, c, ind in D[i]: heappush(H, (ind, r, c)) while H: if H[0][1] >= i: ans[i] = YKC[H[0][2]] break else: heappop(H) print(ans.count("Y"), ans.count("K"), ans.count("C"))