#include <bits/stdc++.h>
using namespace std;
int main() {
  char a;
  char b;
  int x[4], y[4];
  for (int i = 0; i < 4; i++) {
    cin >> a >> b;
    x[i] = a - 'a' + 1;
    y[i] = b - '0';
  }
  bool Q[10][10];
  for (int i = 0; i < 10; i++)
    for (int j = 0; j < 10; j++) {
      Q[i][j] = false;
    }
  for (int q = 0; q < 2; q++) {
    for (int j = 1; j < 9; j++) {
      if ((y[q] != j) &&
          (!((x[q] == x[2]) && (y[2] < max(j, y[q])) && (y[2] > min(j, y[q])))))
        Q[x[q]][j] = true;
      if ((x[q] != j) &&
          (!((y[q] == y[2]) && (x[2] < max(j, x[q])) && (x[2] > min(j, x[q])))))
        Q[j][y[q]] = true;
    }
  }
  for (int i = x[2] - 1; i <= x[2] + 1; i++)
    for (int j = y[2] - 1; j <= y[2] + 1; j++) Q[i][j] = true;
  bool c = true;
  for (int i = max(x[3] - 1, 1); i <= min(x[3] + 1, 8); i++)
    for (int j = max(y[3] - 1, 1); j <= min(y[3] + 1, 8); j++)
      if (!Q[i][j]) c = false;
  if (c)
    cout << "CHECKMATE";
  else
    cout << "OTHER";
  return 0;
}
