package main import . "fmt" import . "os" import bf "bufio" func main() { rd:=bf.NewReader(Stdin) var t int Fscan(rd,&t) for ;t>0;t-- { var x1,y1,x2,y2 int var d1,d2 string Fscan(rd,&x1,&y1,&d1,&x2,&y2,&d2) d:=d1+d2 var ans bool switch { case x1==x2&&y1y2: ans=d=="DU" case y1==y2&&x1x2: ans=d=="LR" case x1y2&&x2-x1==y1-y2: ans=d=="RU"||d=="DL" case x1>x2&&y1x2&&y1>y2&&x1-x2==y1-y2: ans=d=="LU"||d=="DR" } if ans { Println("Yes") } else { Println("No") } } }