from bisect import bisect_left n, k, t = map(int, input().split()) a = input().split() b = list(map(int, input().split())) c = [] for ai, bi in zip(a, b): ci = bi - t if ai == 'A' else bi + t ci %= 2 * k if ci > k: ci = 2 * k - ci c.append(ci) c.sort() ans = [] b2 = sorted(b) for x in b: ans.append(c[bisect_left(b2, x)]) print(*ans)