import sys input = sys.stdin.readline class Bit: def __init__(self, n): self.size = n self.tree = [0] * (n + 1) def sum(self, i): s = 0 while i > 0: s += self.tree[i] i -= i & -i return s def add(self, i, x): while i <= self.size: self.tree[i] += x i += i & -i N, Q = map(int, input().split()) X = list(map(int, input().split())) Qs = [] for i, x in enumerate(X): Qs.append((1, i, x)) for _ in range(Q): c, x, y = input().split() x, y = int(x), int(y) if c == "A": Qs.append((1, x-1, y)) else: Qs.append((0, x-1, y-1)) Qs = Qs[::-1] Y = [0]*N bb = Bit(N+1) for f, x, y in Qs: if f: Y[x] += y * bb.sum(x+1) else: bb.add(x+1, 1) bb.add(y+2, -1) print(*Y)