B. Slanting the board
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output

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.

Input

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.

Output

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".

Examples
Input
3 3
...
.X.
...
...
X..
...
Output
YES
Input
3 3
...
X..
...
...
.X.
...
Output
NO
Input
5 5
..#..
.X..#
.#...
...#.
.X...
..#..
.X..#
.#.X.
...#.
.....
Output
YES