You were playing tic-tac-toe with a friend online. However, there was a problem, another air raid in your area! Being a responsible person, you go to the bomb shelter. After the alarm is over, you come back to finish the game, but something is not right. Your friend may have cheated and changed the board.
You remember the game board $$$A$$$ as it was. Upon returning, you see the same game and the board $$$B$$$. Can you tell if it is possible to obtain board $$$B$$$ from board $$$A$$$ in no more than one move, made according to the rules?
Please note that the first move is made by the player placing the X. Also, the standard rule that the game stops if there are three X's or O's in a row does not apply here.
The first three lines contain three symbols $$$A_{i, j}$$$ each, describing the initial board.
The next three lines contain three symbols $$$B_{i, j}$$$ each, describing the final board.
Each cell of the board is described by three symbols:
It is guaranteed that board A can be obtained by a sequence of valid moves from an empty board.
Output "YES" or "NO" (in any case) depending on whether it was possible to obtain board $$$B$$$ from board $$$A$$$.
.X..X.00..X..X.000
NO
.XX.00...XXX.00...
YES
XXX000...XXX000.X.
YES
0X0X.X0X0X0X0.0X0X
NO
.X........X.......
YES
In the first example, one O is added, but it is now the turn to place an X.
In the second example, one X is added.
In the third example, one X is also added. Note that despite having three O's (and X's) in a row, the game does not stop.
In the fourth example, the board is altered.
In the fifth example, no moves were made.