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) x1*=2 y1*=2 x2*=2 y2*=2 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] time1=10**30 time2=10**30 if v[0]!=0: time1=(x1-x2)//(v[0]) if v[1]!=0: time2=(y1-y2)//(v[1]) if time1==10**30 and time2<10**20: time1=time2 if time2==10**30 and time1<10**20: time2=time1 if time1==10**30: print('No') else: if time1!=time2: print('No') else: if time1>0: print('Yes') else: print('No')