import sys from collections import deque,defaultdict import itertools import heapq import bisect import math #sys.setrecursionlimit(10 ** 9) input = lambda: sys.stdin.readline().rstrip() ii = lambda: int(input()) mi = lambda: map(int, input().split()) ml = lambda: map(str, input().split()) li = lambda: list(mi()) li_st = lambda: list(map(str, input().split())) lli = lambda n: [li() for _ in range(n)] mod = 998244353 T = ii() def check(x,y,d,xx,yy): if d == "U": if yy >= y: y += yy - y else: return x,y,False elif d == "D": if y >= yy: y -= y - yy else: return x,y,False elif d == "L": if x >= xx: x -= x - xx else: return x,y,False else: if xx >= x: x += xx - x else: return x,y,False return x,y,True for i in range(T): x1,y1,d1 = ml() x2,y2,d2 = ml() x1,y1 = int(x1),int(y1) x2,y2 = int(x2),int(y2) ans = set() cc = {(x1,y1),(x2,y2)} x,y,flag1 = check(x1,y1,d1,x2,y2) xx,yy,flag2 = check(x2,y2,d2,x1,y1) if flag1 and flag2: ans.add((x,y)) ans.add((xx,yy)) if len(ans) == 1: print("Yes") else: if ans == cc: print("Yes") else: print("No") else: print("No")