#include #include #include using namespace std; using namespace atcoder; using mint = modint998244353; #define rep(i,n) for (int i = 0; i < (n); ++i) #define Inf32 1000000001 #define Inf64 4000000000000000001 int main(){ long long N,K,T; cin>>N>>K>>T; vector> x(N); rep(i,N)cin>>x[i].first; vector ps; rep(i,N){ cin>>x[i].second; long long cur = x[i].second; if(x[i].first=='A'){ cur = K+K-cur; } cur += T; cur %= (K*2); if(cur<=K)ps.push_back(cur); else{ ps.push_back(K-(cur-K)); } } sort(ps.begin(),ps.end()); vector pos(N); rep(i,N)pos[i] = i; sort(pos.begin(),pos.end(),[&](int a,int b){ return x[a].second pp(N); rep(i,N){ pp[pos[i]] = i; } swap(pp,pos); } rep(i,N){ if(i!=0)cout<<' '; cout<