ENG  RUSTimus Online Judge
Online Judge
Online contests
About Online Judge
Frequently asked questions
Site news
Problem set
Submit solution
Judge status
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests

1195. Ouths and Crosses

Time limit: 1.0 second
Memory limit: 64 MB
The Olympic Winter Games. The Ouths and Crosses on the 3×3 Board Event. The Panel of Judges received an unfinished game with 3 moves made by each player. The players couldn't continue the game because they had lost too much blood at the doping control. The Panel of Judges had to determine the outcome in the case of the optimal play of both parties.
Since there were as many crosses as oughs, the Panel of Judges wanted to decide that it was a draw. However, Head Judge observed that one player was able to win the game in one move. Your task is to determine the outcome in the case of the optimal play of both rivals. According to the International Rules, Crosses move first in the game and the winner is he who puts three of his symbols in the same row, column, or diagonal.


The input contains a 3×3 table consisting of the symbols X, O (the capital English letters, which mark the moves of Crosses and Ouths), and # (this symbol denotes an empty field). The table contains exactly three Crosses and three Ouths. It is guaranteed that the game is not finished, i.e. any row, column or diagonal contains neither three Crosses nor three Ouths.


If Crosses win the game, output “Crosses win”. If Ouths win, output “Ouths win”. In the case of a draw, output “Draw”.


Ouths win
Problem Author: Leonid Volkov, Oleg Katz
Problem Source: Fifth High School Children Programming Contest, Ekaterinburg, March 02, 2002