#include <bits/stdc++.h>
using namespace std;
char pos[5][5];
int M[10][10], TMP[10][10];
int kr, kc;
inline bool valid(int r, int c) { return r >= 0 && r < 8 && c >= 0 && c < 8; }
inline void place(const char* s, int id) {
  int r = s[0] - 'a';
  int c = s[1] - '1';
  M[r][c] = id;
}
inline bool check() {
  int R, C;
  for (int i = 0; i < 8; i++)
    for (int j = 0; j < 8; j++)
      if (M[i][j] == 3) R = i, C = j;
  for (int i = 0; i < 8; i++)
    for (int j = 0; j < 8; j++) {
      if (M[i][j] == 1) {
        if (R == i || C == j) {
          bool flag = true;
          if (R == i) {
            for (int p = min(C, j) + 1; p < max(C, j); p++) {
              if (M[i][p] != 0) {
                flag = false;
                break;
              }
            }
          } else {
            for (int p = min(R, i) + 1; p < max(R, i); p++) {
              if (M[p][j] != 0) {
                flag = false;
                break;
              }
            }
          }
          if (flag) return true;
        }
      } else if (M[i][j] == 2) {
        if (abs(i - R) <= 1 && abs(j - C) <= 1) {
          return true;
        }
      }
    }
  return false;
}
const int mr[8] = {-1, -1, -1, 0, 0, 1, 1, 1};
const int mc[8] = {-1, 0, 1, -1, 1, -1, 0, 1};
inline bool checkmate() {
  if (!check()) {
    return false;
  }
  for (int k = 0; k < 8; k++) {
    for (int i = 0; i < 8; i++)
      for (int j = 0; j < 8; j++) TMP[i][j] = M[i][j];
    if (valid(kr + mr[k], kc + mc[k])) {
      M[kr][kc] = 0;
      M[kr + mr[k]][kc + mc[k]] = 3;
    }
    if (!check()) {
      return false;
    }
    for (int i = 0; i < 8; i++)
      for (int j = 0; j < 8; j++) M[i][j] = TMP[i][j];
  }
  return true;
}
int main() {
  for (int i = 0; i < 4; i++) scanf("%s", pos[i]);
  place(pos[0], 1);
  place(pos[1], 1);
  place(pos[2], 2);
  place(pos[3], 3);
  kr = pos[3][0] - 'a';
  kc = pos[3][1] - '1';
  if (checkmate())
    puts("CHECKMATE");
  else
    puts("OTHER");
  return 0;
}
