T = int(input()) for _ in range(T): ans = False x1,y1,d1 = input().split() x2,y2,d2 = input().split() x1 = int(x1) y1 = int(y1) x2 = int(x2) y2 = int(y2) if d1=='U' and d2=='D': if x1==x2 and y1x2: ans = True if d1=='U' and d2=='R': temp1 = y2-y1 temp2 = x1-x2 if y1+temp1==y2 and x2+temp2==x1 and temp1>=0 and temp2>=0 and temp1==temp2: ans=True if d1=='U' and d2=='L': temp1 = y2-y1 temp2 = x2-x1 if y1+temp1==y2 and x2-temp2==x1 and temp1>=0 and temp2>=0 and temp1==temp2: ans=True if d1=='D' and d2=='R': temp1 = y1-y2 temp2 = x1-x2 if y1-temp1==y2 and x2+temp2==x1 and temp1>=0 and temp2>=0 and temp1==temp2: ans=True if d1=='D' and d2=='L': temp1 = y1-y2 temp2 = x2-x1 if y1-temp1==y2 and x2-temp2==x1 and temp1>=0 and temp2>=0 and temp1==temp2: ans=True x1,y1,d1,x2,y2,d2 = x2,y2,d2,x1,y1,d1 if d1=='U' and d2=='D': if x1==x2 and y1x2: ans = True if d1=='U' and d2=='R': temp1 = y2-y1 temp2 = x1-x2 if y1+temp1==y2 and x2+temp2==x1 and temp1>=0 and temp2>=0 and temp1==temp2: ans=True if d1=='U' and d2=='L': temp1 = y2-y1 temp2 = x2-x1 if y1+temp1==y2 and x2-temp2==x1 and temp1>=0 and temp2>=0 and temp1==temp2: ans=True if d1=='D' and d2=='R': temp1 = y1-y2 temp2 = x1-x2 if y1-temp1==y2 and x2+temp2==x1 and temp1>=0 and temp2>=0 and temp1==temp2: ans=True if d1=='D' and d2=='L': temp1 = y1-y2 temp2 = x2-x1 if y1-temp1==y2 and x2-temp2==x1 and temp1>=0 and temp2>=0 and temp1==temp2: ans=True if ans: print('Yes') else: print('No')