import java.util.*; public class Main { public static void main (String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int m = sc.nextInt(); TreeSet empty = new TreeSet<>(); for (int i = 1; i <= n; i++) { empty.add(i); } int[] counts = new int[3]; for (int i = 0; i < m; i++) { int left = sc.nextInt(); int right = sc.nextInt(); char type = sc.next().charAt(0); int idx; if (type == 'Y') { idx = 0; } else if (type == 'K') { idx = 1; } else { idx = 2; } Integer key = left - 1; while ((key = empty.higher(key)) != null) { if (key > right) { break; } counts[idx]++; empty.remove(key); } } System.out.println(counts[0] + " " + counts[1] + " " + counts[2]); } }