using System; using static System.Console; using System.Linq; using System.Collections.Generic; class Program { static int NN => int.Parse(ReadLine()); static int[] NList => ReadLine().Split().Select(int.Parse).ToArray(); public static void Main() { Solve(); } static void Solve() { var c = NList; var (n, k, t) = (c[0], c[1], c[2]); var a = ReadLine().Split(); var b = NList; var clocks = new List<(int id, int dir, int pos)>(n); for (var i = 0; i < n; ++i) { clocks.Add((i, a[i] == "A" ? -1 : 1, b[i])); } clocks.Sort((l, r) => l.pos.CompareTo(r.pos)); var after = new List(n); for (var i = 0; i < n; ++i) { after.Add(GetPos(clocks[i].pos, clocks[i].dir, k, t)); } after.Sort(); var ans = new int[n]; for (var i = 0; i < n; ++i) ans[clocks[i].id] = after[i]; WriteLine(string.Join(" ", ans)); } static int GetPos(int begin, int dir, int len, int time) { var after = Math.Abs((begin + dir * time) % (len * 2)); if (after > len) return 2 * len - after; else return after; } }