#include using namespace std; int main () { using ll = long long; int N; ll K, T; cin >> N >> K >> T; char A[200020]; pair B[200020]; for (int i = 0; i < N; i ++) { cin >> A[i]; } for (int j = 0; j < N; j ++) { ll b; cin >> b; B[j] = make_pair(b, j); } sort(B, B + N); ll ans[200020]; T %= (K * 2); for (int i = 0; i < N; i ++) { auto [b, j] = B[i]; char c = A[j]; if (c == 'A') { ll x = abs(T - b); if (x > K) { x = K - (x - K); } ans[i] = x; } else { ll y = K - b; y = abs(T - y); if (y > K) { y = K - (y - K); } ans[i] = K - y; } } sort(ans, ans + N); ll a2[200020]; for (int i = 0; i < N; i ++) { a2[B[i].second] = ans[i]; } for (int i = 0; i < N; i ++) { cout << a2[i] << " "; } cout << endl; }