The color X always goes first. A marker can only be inserted on the board by sliding it onto a particular row from the left or from the right, or onto a particular column from the top or from the bottom. When a marker is inserted, there may be a marker on the square where the insertion takes place. In this case, all markers on the insertion row or column from the insertion square upto the first empty square are moved one square further to make room for the inserted marker. A game always leads to a win by one of the two players.
Draws are impossible.
There are no intervening spaces or empty lines. If the standard input only contains a single line, it simply means a null sequence of moves. This sequence of moves specifies an incomplete game. The program must read the incomplete game from standard input and find which is the best move to make next. The program's sole output, on standard output, is a single line indicating the best next move.