There are n robots driving along an OX axis. There are also two walls: one is at coordinate 0 and one is at coordinate m.

The i-th robot starts at an integer coordinate x_i~(0 < x_i < m) and moves either left (towards the 0) or right with the speed of 1 unit per second. No two robots start at the same coordinate.

Whenever a robot reaches a wall, it turns around instantly and continues his ride in the opposite direction with the same speed.

Whenever several robots meet at the same integer coordinate, they collide and explode into dust. Once a robot has exploded, it doesn't collide with any other robot. Note that if several robots meet at a non-integer coordinate, nothing happens.

For each robot find out if it ever explodes and print the time of explosion if it happens and -1 otherwise.

Input

The first line contains a single integer t (1 ≤ t ≤ 1000) — the number of testcases.

Then the descriptions of t testcases follow.

The first line of each testcase contains two integers n and m (1 ≤ n ≤ 3 ⋅ 10^5; 2 ≤ m ≤ 10^8) — the number of robots and the coordinate of the right wall.

The second line of each testcase contains n integers x_1, x_2, ..., x_n (0 < x_i < m) — the starting coordinates of the robots.

The third line of each testcase contains n space-separated characters 'L' or 'R' — the starting directions of the robots ('L' stands for left and 'R' stands for right).

All coordinates x_i in the testcase are distinct.

The sum of n over all testcases doesn't exceed 3 ⋅ 10^5.

Output

For each testcase print n integers — for the i-th robot output the time it explodes at if it does and -1 otherwise.

Example

Input


5
7 12
1 2 3 4 9 10 11
R R L L R R R
2 10
1 6
R R
2 10
1 3
L L
1 10
5
R
7 8
6 1 7 2 3 5 4
R L R L L L L


Output


1 1 1 1 2 -1 2 
-1 -1 
2 2 
-1 
-1 2 7 3 2 7 3 

Note

Here is the picture for the seconds 0, 1, 2 and 3 of the first testcase: 

<image>

Notice that robots 2 and 3 don't collide because they meet at the same point 2.5, which is not integer.

After second 3 robot 6 just drive infinitely because there's no robot to collide with.
// time-limit: 2000
// problem-url: https://codeforces.com/problemset/problem/223/B
// #pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native,avx2,fma")
// #pragma GCC optimize ("-ffloat-store")
// #pragma GCC optimize("Ofast")
// #pragma GCC optimization ("unroll-loops")
#include "bits/stdc++.h"
using namespace std;

// #include <ext/pb_ds/assoc_container.hpp> 
// #include <ext/pb_ds/tree_policy.hpp> // order_of_key() ; *( find_by_order() ) -> kth element in set;
// using namespace __gnu_pbds;  // order_of_key(k) -> Number of elements strictly smaller than k
// template <typename T>
// using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

unsigned seed = chrono::system_clock::now().time_since_epoch().count();
mt19937 ran(seed); // ran() generates a random number

#define ld long double
// #define ll long long int
#define ll int
#define endl '\n'
#define vll vector<ll>
#define vvl vector<vll>
#define pll pair<ll,ll>
#define ppl pair<pll,ll>
#define vpll vector<pll>
#define mp make_pair
#define pb push_back
#define mapll map<ll,ll>
#define fir first
#define sec second
#define _cin ios_base::sync_with_stdio(0);  cin.tie(0); cout.tie(0);
#define fo(i,b) for(i=0;i<b;++i)
#define repa(i,a,b) for(i=a;i<b;++i)
#define repb(i,a,b) for(i=a;i>=b;--i)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define s(v) (ll)((v).size())
#define inf 2000000000000000010 
#define mod  1000000007
#define mod1 998244353

#define mul(a,b,m) (((a%m) * 1LL * (b%m))%m)
#define add(a,b,m) (((a)+(b)>=m) ? ((a)+(b)-(m)) : ((a)+(b)))
#define sub(a,b,m) (((a)-(b) <0) ? ((a)-(b)+(m)) : ((a)-(b)))

                            /*DEBUG*/
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifdef NPRAKHAR
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#define Time cerr << "Time : " << 1000 * ((double)clock()-start) / (double)CLOCKS_PER_SEC << "ms\n"
#else
#define debug(x...) 
#define Time 
#endif
                        /*END*/
clock_t start = clock();
ll gcd(ll a, ll b) {return (a==0) ? b : gcd(b%a,a);}
ll power(ll a, ll n) {ll p = 1;while (n > 0) {if(n%2) {p = p * a;} n >>= 1; a *= a;} return p;}
ll powm(ll a, ll n, ll mod_){ ll p=1; while(n){ if(n%2){ p=mul(p,a,mod_);} n>>=1; a=mul(a,a,mod_);} return p%mod_;} 
ll powi(ll a, ll mod_) {return powm(a,mod_-2,mod_);}
                          /*Code Begins*/
void pre();





void test_case(){
    ll mn , mx;
    ll i, j, k, l, r;
    ll n, m, x, y, z;
    ll sum=0, cnt=0;
    
    cin >> n >> m;
    vpll pos(n);
    vll dir(n);
    fo(i,n) cin >> pos[i].first, pos[i].second=i;
    fo(i,n){
        char c;
        cin >> c;
        if(c== 'L') dir[i]=-1;
        else dir[i]=1;
    }
    vll ans(n,-1);
    set<pll> lo, le, ro, re;
    fo(i,n){
        if(dir[i]==1){
            if(pos[i].first%2) ro.insert(pos[i]);
            else re.insert(pos[i]);
        }else{
            if(pos[i].first%2) lo.insert(pos[i]);
            else le.insert(pos[i]);
        }
    }
    set<pll> remo, reme;
    for(auto it = ro.rbegin(); it != ro.rend();++it){
        if(lo.lower_bound(*it) != lo.end()){
            ans[lo.lower_bound(*it)->second] = ans[it->second] = (lo.lower_bound(*it)->first - it->first)/2;
            // ans[lo.lower_bound(*it)->second] = lo.lower_bound(*it)->first - it->first;
            lo.erase(lo.lower_bound(*it));
        }else{
            remo.insert(*it);
        }
    }
    ro = remo;
    remo.clear();
    for(auto it = re.rbegin(); it != re.rend();++it){
        if(le.lower_bound(*it) != le.end()){
            ans[le.lower_bound(*it)->second] = ans[it->second] = (le.lower_bound(*it)->first - it->first)/2;
            // ans[le.lower_bound(*it)->second] = le.lower_bound(*it)->first - it->first;
            le.erase(le.lower_bound(*it));
        }else{
            reme.insert(*it);
        }
    }
    re = reme;
    reme.clear();
    while(ro.size() > 1u){
        auto last = ro.rbegin();
        auto prev = ++ro.rbegin();
        ans[prev->second] = ans[last->second] = m - (prev->first + last->first)/2;
        ro.erase(--ro.end());
        ro.erase(--ro.end());
    }
    while(re.size() > 1u){
        auto last = re.rbegin();
        auto prev = ++re.rbegin();
        ans[prev->second] = ans[last->second] = m - (prev->first + last->first)/2;
        re.erase(--re.end());
        re.erase(--re.end());
    }
    while(lo.size() > 1u){
        auto st = lo.begin();
        auto nex = ++lo.begin();
        ans[st->second] = ans[nex->second] = (st->first + nex->first)/2;
        lo.erase(lo.begin());
        lo.erase(lo.begin());
    }
    while(le.size() > 1u){
        auto st = le.begin();
        auto nex = ++le.begin();
        ans[st->second] = ans[nex->second] = (st->first + nex->first)/2;
        le.erase(le.begin());
        le.erase(le.begin());
    }
    
    if(ro.size() and lo.size() ){
        ans[ro.begin()->second] = ans[lo.begin()->second] = (2*m- ro.begin()->first + lo.begin()->first)/2;
    }
    if(re.size() and le.size()){
        ans[re.begin()->second] = ans[le.begin()->second] = (2*m- re.begin()->first + le.begin()->first)/2;
    }
    
    fo(i,n) cout << ans[i] << ' ';
}




int main(){
    _cin
    // cout << setprecision(20);
    int TC=1, tc=0;
    cin >> TC;
    pre();
    while(tc++ < TC){ 
        // cout << "Case #" << tc << ": ";
        test_case();
        cout << '\n';
    }    
    Time;
    return 0;
}

void pre(){

    return;
}