n, m, k, q = map(int, input().split()) grid = [] for i in range(n): grid.append([0]*m) for something in range(k): op = input().split() if op[0] == "R": color = int(op[2]) row = int(op[1])-1 for column in range(m): grid[row][column] = color if op[0] == "C": color = int(op[2]) column = int(op[1])-1 for row in range(n): grid[row][column] = color result = [0]*q for listt in grid: for element in listt: for i in range(q): if element == i+1: result[element-1] += 1 final_result = " ".join(map(str,result)) print(final_result)