T=int(input()) for t in range(T): X,Y,dX,dY=[],[],[],[] for _ in range(2): x,y,d=input().split() x=int(x) y=int(y) X.append(x) Y.append(y) if d=="R": dx,dy=1,0 elif d=="L": dx,dy=-1,0 elif d=="U": dx,dy=0,1 elif d=="D": dx,dy=0,-1 dX.append(dx) dY.append(dy) if X[0]X[1]: X=[1,0] else: X=[0,0] if Y[0]Y[1]: Y=[1,0] else: Y=[0,0] XY=[set(),set()] for i in range(2): for t in range(5): XY[i].add((X[i]+dX[i]*t,Y[i]+dY[i]*t)) if XY[0]&XY[1]: ans="Yes" else: ans="No" print(ans)