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.
#------------------Important Modules------------------#
from sys import stdin,stdout
from bisect import bisect_left as bl
from bisect import bisect_right as br
from heapq import *
from random import *
from itertools import permutations
input=stdin.readline
prin=stdout.write
from random import sample
from collections import Counter,deque
from fractions import *
from math import sqrt,ceil,log2,gcd,cos,pi,floor
from copy import deepcopy
#dist=[0]*(n)
mod=10**9+7
mod2=998244353
def ps(n):
    cp=0;lk=0;arr={}
    lk=0;ap=n
    cc=0
    while n%2==0:
        n=n//2
        cc=1
    if cc==1:
        lk+=1
        
    
    
    
        
    for ps in range(3,ceil(sqrt(n))+1,2):
        #print(ps)
        cc=0
        while n%ps==0:
            n=n//ps
            cc=1

        lk+=1 if cc==1 else 0
        
            
            
    if n!=1:
        lk+=1
    
    if lk==1:    
        return False
        
    
    #print(arr)
    
    return True


#count=0
#dp=[[0 for i in range(m)] for j in range(n)]
#[int(x) for x in input().strip().split()]
def gcd(x, y): 
      
    while(y): 
        x, y = y, x % y 
      
    return x 
          
# Driver Code         
def factorials(n,r):
    #This calculates ncr mod 10**9+7
    slr=n;dpr=r
    qlr=1;qs=1
    mod=10**9+7
    
    for ip in range(n-r+1,n):
        qlr=(qlr*ip)%mod
    for ij in range(1,r):
        qs=(qs*ij)%mod
    #print(qlr,qs)
    ans=(qlr*modInverse(qs))%mod
    return ans

        
        
def modInverse(b):
    qr=10**9+7
    return pow(b, qr - 2,qr)

#===============================================================================================
### START ITERATE RECURSION ###
from types import GeneratorType
def iterative(f, stack=[]):
  def wrapped_func(*args, **kwargs):
    if stack: return f(*args, **kwargs)
    to = f(*args, **kwargs)
    while True:
      if type(to) is GeneratorType:
        stack.append(to)
        to = next(to)
        continue
      stack.pop()
      if not stack: break
      to = stack[-1].send(to)
    return to
  return wrapped_func
def power(arr):
  listrep = arr
  subsets = []
  for i in range(2**len(listrep)):
    subset = []
    for k in range(len(listrep)):            
      if i & 1<<k:
        subset.append(listrep[k])
    subsets.append(subset)        
  return subsets
def pda(n) :
    list=[];su=0
    for i in range(1, int(sqrt(n) + 1)) :
         if (n % i == 0) :
            if (n // i == i) :
                list.append(i)
                su+=i
            else :
                list.append(n//i);list.append(i)
                su+=i;su+=n//i
    # The list will be printed in reverse    
    return su
def dis(xa,ya,xb,yb):
    return sqrt((xa-xb)**2+(ya-yb)**2)
#### END ITERATE RECURSION ####

 
#===============================================================================================
#----------Input functions--------------------#
def ii():
    return int(input())
def ilist():
    return [int(x) for x in input().strip().split()]
def islist():
    return list(map(str,input().split().rstrip()))
def inp():
    return input().strip()
def google(test):
    return "Case #"+str(test)+": ";
def overlap(x1,y1,x2,y2):
    if x2>y1:
        return y1-x2
    if y1>y2:
        return y2-x2
    return y1-x2;


###-------------------------CODE STARTS HERE--------------------------------###########

        
    

def dist(x1,y1,x2,y2):
    return sqrt((x1-x2)**2+(y1-y2)**2)
def sieve(n):
      
    
    prime = [True for i in range(n + 1)]
    p = 2
    while (p * p <= n):
          
        
        if (prime[p] == True):
              
            
            for i in range(p * 2, n + 1, p):
                prime[i] = False
        p += 1
    prime[0]= False
    prime[1]= False
    ans=[]
    for i in range(1,n+1):
        if prime[i]:
            ans.append(i)
    return ans
        
            
def prod(arr):
    n=len(arr)
    k=1
    for j in range(n):
        k*=arr[j]
    return k
def SumOfDigits(s):
    su=0
    while (s):
        su+=s%10
        s=s//10
    return su
def std():
    return stdout.flush()
    
#########################################################################################
#def valid(sec,hr,min,nano):
def finds(s):
    att=0
    i=1
    while i<len(s):
        att=int(s[:i])
        j=i
        cc=0
        while j<len(s):
            att+=1
            sk=att
            news=str(sk)
            rr=len(news)
            #print(i,j,news,rr,s[j:j+rr])
            if news==s[j:j+rr]:
                #print(i,j,news,rr,s[j:j+rr])
                j+=rr
                
                #continue
            else:
                cc=1
                break
        if cc==0:
            return True
        i+=1
    return False
            
                

    
#print(finds('78910'))
arr=[]
for i in range(1,10001):
    s=str(i)
    j=i
    while len(s)<=7:
        j+=1
        s+=str(j)
        arr.append(int(s))

        

arr.sort()    
def subs(arr):
  
    
    res = set()
  
    pre = {0}
  
    for x in arr:
        pre = {x | y for y in pre} | {x}
        res |= pre
  
    return len(res)    
    
def sl(n):
    return (n*(n+1))//2

t=ii()
#t=1

            
for pl in range(t):
    n,m=ilist()
    arr=[[0]*3 for i in range(n)]
    brr=ilist()
    crr=list(map(str,input().strip().split()))
    for i in range(n):
        arr[i][0]=brr[i]
        arr[i][1]=crr[i]
        arr[i][2]=i
    arr=sorted(arr,key =lambda x : x[0])
    #print(arr)
    
    oddr=[];oddl=[];evenr=[];evenl=[]
    time=[-1]*n
    for i in range(n):
        lx=arr[i]
        if lx[1]=='L':
            if lx[0]%2==0:
                if len(evenr)>0:
                    qx=evenr[-1]
                    time[qx[1]]=time[lx[2]]=(lx[0]-qx[0])//2
                    evenr.pop()
                    continue
                    
                    
                    
                    
                    
            else:
                if len(oddr)>0:
                    qx=oddr[-1]
                    time[qx[1]]=time[lx[2]]=(lx[0]-qx[0])//2
                    oddr.pop()
                    continue
            if lx[0]%2==0:
                evenl.append([lx[0],lx[2]])
            else:
                oddl.append([lx[0],lx[2]])
        else:
            lx=arr[i]
            if lx[0]%2==0:
                evenr.append([lx[0],lx[2]])
            else:
                oddr.append([lx[0],lx[2]])
    if len(evenl)>0:
        i=0
        while i<len(evenl)-1:
            lx=evenl[i]
            px=evenl[i+1]
            time[lx[1]]=time[px[1]]=(lx[0]+px[0])//2
            i+=2
    if len(oddl)>0:
        i=0
        while i<len(oddl)-1:
            lx=oddl[i]
            px=oddl[i+1]
            time[lx[1]]=time[px[1]]=(lx[0]+px[0])//2
            i+=2
    evenr=evenr[::-1]
    oddr=oddr[::-1]
    if len(evenr)>0:
        i=0
        #evenr=evenr[::-1]
        while i<len(evenr)-1:
            lx=evenr[i]
            px=evenr[i+1]
            time[lx[1]]=time[px[1]]=(2*m-lx[0]-px[0])//2
            i+=2
    if len(oddr)>0:
        i=0
        #oddr=oddr[::-1]
        while i<len(oddr)-1:
            lx=oddr[i]
            px=oddr[i+1]
            time[lx[1]]=time[px[1]]=(2*m-lx[0]-px[0])//2
            i+=2
    if len(evenr)%2!=0 and len(evenl)%2!=0:
        lx=evenr[-1]
        px=evenl[-1]
        maxer=max(m-lx[0],px[0])
        miner=min(m-lx[0],px[0])
        time[lx[1]]=time[px[1]]=(maxer+(m-maxer+miner)//2)
    if len(oddr)%2!=0 and len(oddl)%2!=0:
        lx=oddr[-1]
        px=oddl[-1]
        maxer=max(m-lx[0],px[0])
        miner=min(m-lx[0],px[0])
        time[lx[1]]=time[px[1]]=(maxer+(m-maxer+miner)//2)
        
        
    print(*time)
    
            
            
            
            
                
        
     
        
    
                
                
            
            
    
        
        
        
            
            
            
            
        
        
    
        
    
        
                
    
            
    
                
        
            
        
                    
                    
                    
                        
                    
                    
                    
                
                
            
        
            
        
            
        
    
        
    
        
    
        
    
        
        
        
                
            
                
            
        
        
        
    
    
                
                
        
    
        
        
    
        
    
    
    
    
    
        
                
    
            
            
    
    





















    
