local n, k, q = io.read("*n", "*n", "*n", "*l") local ta, tb, tc = {}, {}, {} for i = 1, q do local a, b, c = io.read():match("(%w) (%d+) (%d+)") ta[i], tb[i], tc[i] = (a == "R"), tonumber(b), tonumber(c) end local rowused, colused = {}, {} for i = 1, n do rowused[i], colused[i] = false, false end local rowrem, colrem = n, n local color = {} for i = 1, k do color[i] = 0 end for i = q, 1, -1 do if ta[i] then if not rowused[tb[i]] then rowused[tb[i]] = true color[tc[i]] = color[tc[i]] + colrem rowrem = rowrem - 1 end else if not colused[tb[i]] then colused[tb[i]] = true color[tc[i]] = color[tc[i]] + rowrem colrem = colrem - 1 end end end for i = 1, n do if not rowused[i] then color[1] = color[1] + colrem end end for i = 1, k do print(color[i]) end