5646: Game of chess unfinished

内存限制:256 MB 时间限制:1 S 标准输入输出
题目类型:传统 评测方式:文本比较 上传者:
提交:2 通过:2

题目描述

有一次沃洛佳在博物馆,看到一个普通的棋盘是博物馆的棋子。而且上面只有四个棋子:两个白鸦,一个白国王和一个黑国王。“啊哈,黑当然没有赢!”沃洛佳说,肯定是对的。你的任务是说白是否赢了。

    棋盘上的棋子保证代表正确的位置(每个棋子占据一个单元格,没有两个棋子占据同一个单元格,国王不能互相拿走)。因此,你的任务只是决定白人是否与黑人交配。我们要提醒您,这意味着黑王此刻可以被对手的棋子之一带走,而且它也不能移动到不败的位置。一只车垂直或水平移动任意数量的自由细胞(假设它的路径上没有其他部分),一个国王 - 到相邻的细胞(角落或侧面)。当然,棋子不能离开棋盘。黑王也许可以在轮到他时拿走对手的车(见样本3)。
Once Volodya was at the museum and saw a regular chessboard as a museum piece. And there were only four chess pieces on it: two white rooks, a white king and a black king. "Aha, blacks certainly didn't win!", − Volodya said and was right for sure. And your task is to say whether whites had won or not.

Pieces on the chessboard are guaranteed to represent a correct position (every piece occupies one cell, no two pieces occupy the same cell and kings cannot take each other). Thus, your task is only to decide whether whites mate blacks. We would remind you that it means that the black king can be taken by one of the opponent's pieces at the moment and also it cannot move to an unbeaten position. A rook moves vertically or horizontally by any number of free cells (assuming there are no other pieces on its path), a king − to the adjacent cells (either by corner or by side). Certainly, pieces cannot leave the board. The black king might be able to take opponent's rooks at his turn (see sample 3).
Input
The input contains 4 space-separated piece positions: positions of the two rooks, the white king and the black king. Each position on 8×8 chessboard is denoted by two symbols − ('a' - 'h') and ('1' - '8') − which stand for horizontal and vertical coordinates of the cell occupied by the piece. It is guaranteed, that no two pieces occupy the same cell, and kings cannot take each other.
Output
Output should contain one word: "CHECKMATE" if whites mate blacks, and "OTHER" otherwise.
Examples
Input
a6 b4 c8 a8
Output
CHECKMATE
Input
a6 c4 b6 b8
Output
OTHER
Input
a2 b1 a3 a1
Output
OTHER

输入格式

输入包含 4 个空格分隔的棋子位置:两个车的位置,白王和黑王。8×8棋盘上的每个位置都由两个符号表示 - ('a' - 'h')和('1' - '8') - 代表棋子所占据单元格的水平和垂直坐标。 可以保证的是,没有两块占据同一个牢房,国王不能互相夺取。

输出格式

输出应包含一个单词:CHECKMATE”(如果whites mate blacks),则包含“OTHER”。

Input

a6 b4 c8 a8

Output

CHECKMATE

Input

a6 c4 b6 b8

Output

OTHER

Input

a2 b1 a3 a1

Output

OTHER

输入样例 复制

a2 b1 a3 a1

输出样例 复制

OTHER