#include <bits/stdc++.h>
using namespace std;
int main() {
  string rook1, rook2, white, black;
  cin >> rook1 >> rook2 >> white >> black;
  int arr[8][8];
  for (int i = 0; i < 8; i++)
    for (int j = 0; j < 8; j++) arr[i][j] = 0;
  int r1x, r1y, r2x, r2y, wx, wy, bx, by;
  r1x = rook1[0] - 'a';
  r1y = rook1[1] - '0' - 1;
  r2x = rook2[0] - 'a';
  r2y = rook2[1] - '0' - 1;
  wx = white[0] - 'a';
  wy = white[1] - '0' - 1;
  bx = black[0] - 'a';
  by = black[1] - '0' - 1;
  for (int i = r1y + 1; i < 8; i++) {
    if (r1x == r2x && i == r2y + 1) break;
    if (wx == r1x && i == wy + 1) break;
    arr[r1x][i]++;
  }
  for (int i = r1y - 1; i >= 0; i--) {
    if (r1x == r2x && i == r2y - 1) break;
    if (wx == r1x && i < wy) break;
    arr[r1x][i]++;
  }
  for (int i = r1x + 1; i < 8; i++) {
    if (r1y == r2y && i == r2x + 1) break;
    if (wy == r1y && i == wx + 1) break;
    arr[i][r1y]++;
  }
  for (int i = r1x - 1; i >= 0; i--) {
    if (r1y == r2y && i == r2x - 1) break;
    if (wy == r1y && i == wx - 1) break;
    arr[i][r1y]++;
  }
  for (int i = r2y + 1; i < 8; i++) {
    if (r1x == r2x && i == r1y + 1) break;
    if (wx == r2x && i == wy + 1) break;
    arr[r2x][i]++;
  }
  for (int i = r2y - 1; i >= 0; i--) {
    if (r1x == r2x && i == r1y - 1) break;
    if (wx == r2x && i == wy - 1) break;
    arr[r2x][i]++;
  }
  for (int i = r2x + 1; i < 8; i++) {
    if (r1y == r2y && i == r1x + 1) break;
    if (wy == r2y && i == wx + 1) break;
    arr[i][r2y]++;
  }
  for (int i = r2x - 1; i >= 0; i--) {
    if (r1y == r2y && i == r1x - 1) break;
    if (wy == r2y && i == wx - 1) break;
    arr[i][r2y]++;
  }
  if (wx > 0) arr[wx - 1][wy]++;
  if (wy > 0) arr[wx][wy - 1]++;
  if (wx > 0 && wy > 0) arr[wx - 1][wy - 1]++;
  if (wx > 0 && wy < 7) arr[wx - 1][wy + 1]++;
  if (wx < 7 && wy > 0) arr[wx + 1][wy - 1]++;
  if (wx < 7 && wy < 7) arr[wx + 1][wy + 1]++;
  if (wx < 7) arr[wx + 1][wy]++;
  if (wy < 7) arr[wx][wy + 1]++;
  wx = bx;
  wy = by;
  bool flag = false;
  if (wx > 0 && arr[wx - 1][wy] == 0) flag = true;
  if (wy > 0 && arr[wx][wy - 1] == 0) flag = true;
  if (wx > 0 && wy > 0 && arr[wx - 1][wy - 1] == 0) flag = true;
  if (wx > 0 && wy < 7 && arr[wx - 1][wy + 1] == 0) flag = true;
  if (wx < 7 && wy > 0 && arr[wx + 1][wy - 1] == 0) flag = true;
  if (wx < 7 && wy < 7 && arr[wx + 1][wy + 1] == 0) flag = true;
  if (wx < 7 && arr[wx + 1][wy] == 0) flag = true;
  if (wy < 7 && arr[wx][wy + 1] == 0) flag = true;
  if (arr[wx][wy] == 0) flag = true;
  if (flag)
    cout << "OTHER";
  else
    cout << "CHECKMATE";
  return 0;
}
