#include <bits/stdc++.h>
using namespace std;
int main() {
  int i = 0;
  string input;
  cin >> input;
  string out = "CHECKMATE";
  int rook1, rook2, king, king2;
  rook1 = 8 * (input[0] - 'a') + input[1] - '1';
  cin >> input;
  rook2 = 8 * (input[0] - 'a') + input[1] - '1';
  cin >> input;
  king = 8 * (input[0] - 'a') + input[1] - '1';
  cin >> input;
  king2 = 8 * (input[0] - 'a') + input[1] - '1';
  int board[64];
  for (i = 0; i < 64; i++) {
    board[i] = 0;
  }
  for (i = rook1 % 8 + 1; i < 8; i++) {
    board[8 * (rook1 / 8) + i] = 1;
    if (8 * (rook1 / 8) + i == king) i = 8;
  }
  for (i = rook2 % 8 + 1; i < 8; i++) {
    board[8 * (rook2 / 8) + i] = 1;
    if (8 * (rook2 / 8) + i == king) i = 8;
  }
  for (i = rook1 % 8 - 1; i > -1; i--) {
    board[8 * (rook1 / 8) + i] = 1;
    if (8 * (rook1 / 8) + i == king) i = -1;
  }
  for (i = rook2 % 8 - 1; i > -1; i--) {
    board[8 * (rook2 / 8) + i] = 1;
    if (8 * (rook2 / 8) + i == king) i = -1;
  }
  for (i = rook1 + 8; i < 64; i += 8) {
    board[i] = 1;
    if (i == king) i = 64;
  }
  for (i = rook2 + 8; i < 64; i += 8) {
    board[i] = 1;
    if (i == king) i = 64;
  }
  for (i = rook1 - 8; i >= 0; i -= 8) {
    board[i] = 1;
    if (i == king) i = -1;
  }
  for (i = rook2 - 8; i >= 0; i -= 8) {
    board[i] = 1;
    if (i == king) i = -1;
  }
  int j;
  for (i = -1; i < 2; i++) {
    for (j = -1; j < 2; j++) {
      if ((king + i + 8 * j >= 0 && king + i + 8 * j < 64) &&
          ((king % 8 + i) >= 0 && (king % 8 + i) < 8))
        board[king + i + 8 * j] = 1;
    }
  }
  for (i = -1; i < 2; i++) {
    for (j = -1; j < 2; j++) {
      if ((king2 + i + 8 * j >= 0 && king + i + 8 * j < 64) &&
          ((king2 % 8 + i) >= 0 && (king2 % 8 + i) < 8))
        if (board[king2 + i + 8 * j] == 0) {
          out = "OTHER";
        }
    }
  }
  cout << out << endl;
}
