We have a maze with $$$T (1\le T\le 3)$$$ spheric balls inside. We want to achieve a certain state of the maze by only slanting it to any of the four cardinal directions. So, for example, if we slant the maze to the north, then the spheric balls would move up the maze until they hit a wall, hit another ball, or hit the border of the maze.
Given the initial and final states of the maze, say if we can achieve the final state only by slanting the maze to the four cardinal directions.
The first line contains $$$N$$$ and $$$M$$$ $$$(1\le N\cdot M\le 60)$$$ – the number of rows and columns of the maze, respectively.
The next $$$N$$$ lines each contain a string of $$$M$$$ characters detailing the initial state of the maze. The character '$$$\texttt{.}$$$' represents a free space in the maze, '$$$\texttt{X}$$$' represents a spheric ball, and '$$$\texttt{#}$$$' represents a wall.
The last $$$N$$$ lines represent the final state of the maze, following the same convention as with the initial state.
Print "YES" if we can achieve the final state of the maze by slanting the maze with the initial state to the four cardinal directions; otherwise, print "NO".
3 3....X.......X.....
YES
3 3...X.........X....
NO
5 5..#...X..#.#......#..X.....#...X..#.#.X....#......
YES
| Name |
|---|


