So clever the Wodex and his partners were! They got the right sort of values. But not over yet.
What happened? The castle was shaking! Suddenly, the castle collapsed and they were swallowed up by dark.
When they waked up, they found they were surrounded by lots of tall walls.
At the same time, horn sounded:
If you want to beat me, you should pass this level. Look at the map, there is a M * N maze, later you will be appeared in the map, each 1 * 1 lattice in the map means a room. There are only two characters 'X' and 'O' in the map, 'X' means that room is bad and you can not get in; 'O' means intact room that you can get in. There will must be a door and only one door between two adjoining and intact rooms. At the beginning, all of doors are opened, if you walk from one intact room to the adjoining and intact room, the door between them will close, that means you can not go again from these two rooms. Only all of doors are closed, you can be deliveried out of the maze and you will see me.
Look, there is a transfer machine next to you, you can use it to choose any one room to get in the maze and you will start at that room.
How can you walk to open all of doors? Start now!
If they can open all of doors, print 'YES', otherwse print 'NO'.
There will be at least one intact room.