Tic-Tac-Toe
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 as it was. Upon returning, you see the same game and the board . Can you tell if it is possible to obtain board from board 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.
Input
The first three lines contain three symbols each, describing the initial board.
The next three lines contain three symbols each, describing the final board.
Each cell of the board is described by three symbols:
"
.
" — denotes an empty cell;"
0
" — denotes a placed O;"
X
" — denotes a placed X.
It is guaranteed that board A can be obtained by a sequence of valid moves from an empty board.
Output
Output "YES
" or "NO
" (in any case) depending on whether it was possible to obtain board from board .
Examples
Note
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.