Q=int(input()) for _ in range(Q): x1,y1,d1=input().split() x2,y2,d2=input().split() x1=int(x1) x2=int(x2) y1=int(y1) y2=int(y2) L=[[1,0],[-1,0],[0,1],[0,-1]] s='RLUD' T={} for i in range(4): T[s[i]]=i v=[0]*2 k=L[T[d2]] for j in range(2): v[j]+=k[j] k=L[T[d1]] for j in range(2): v[j]-=k[j] if v[0]==0 and v[1]==0: print('No') continue if v[0]==0: time=(y1-y2)/(v[1]) if time>0: print('Yes') else: print('No') elif v[1]==0: time=(x1-x2)/(v[0]) if time>0: print('Yes') else: print('No') else: time1=(x1-x2)//(v[0]) time2=(y1-y2)//(v[1]) if time1!=time2: print('No') else: if time1>0: print('Yes') else: print('No')