#include <bits/stdc++.h>
using namespace std;
bool gprintf(int debug, const char *format, ...) {
  if (0 & debug) {
    va_list listpointer;
    va_start(listpointer, format);
    vfprintf(stderr, format, listpointer);
    va_end(listpointer);
    return true;
  } else
    return false;
}
bool attack[10][10];
void mark_rook(int r, int c, int kr, int kc) {
  int p1, p2;
  p1 = p2 = r;
  while (p1 >= 0 || p2 < 8) {
    if (p1 >= 0) {
      if (p1 == kr && kc == c)
        p1 = -1;
      else {
        attack[p1][c] = true;
        p1--;
      }
    }
    if (p2 < 8) {
      if (p2 == kr && kc == c)
        p2 = 8;
      else {
        attack[p2][c] = true;
        p2++;
      }
    }
  }
  p1 = p2 = c;
  while (p1 >= 0 || p2 < 8) {
    if (p1 >= 0) {
      if (r == kr && p1 == kc)
        p1 = -1;
      else {
        attack[r][p1] = true;
        p1--;
      }
    }
    if (p2 < 8) {
      if (r == kr && p2 == kc)
        p2 = 8;
      else {
        attack[r][p2] = true;
        p2++;
      }
    }
  }
}
bool adjacent(int r, int c, int ar, int ac) {
  int dr = r - ar;
  int dc = c - ac;
  if (dr < 0) dr = -dr;
  if (dc < 0) dc = -dc;
  return (dr <= 1) && (dc <= 1);
}
int main() {
  char rook[2][10], wk[10], bk[10];
  memset(attack, 0, sizeof(attack));
  scanf("%s %s %s %s", rook[0], rook[1], wk, bk);
  mark_rook(rook[0][0] - 'a', rook[0][1] - '1', wk[0] - 'a', wk[1] - '1');
  mark_rook(rook[1][0] - 'a', rook[1][1] - '1', wk[0] - 'a', wk[1] - '1');
  int kr, kc;
  int rook_r[2], rook_c[2];
  int wr, wc;
  rook_r[0] = rook[0][0] - 'a';
  rook_r[1] = rook[1][0] - 'a';
  rook_c[0] = rook[0][1] - '1';
  rook_c[1] = rook[1][1] - '1';
  wr = wk[0] - 'a';
  wc = wk[1] - '1';
  kr = bk[0] - 'a';
  kc = bk[1] - '1';
  const char *res;
  if (attack[kr][kc]) {
    int i, j;
    res = "CHECKMATE";
    for ((i) = (-1); (i) <= (1); (i)++)
      for ((j) = (-1); (j) <= (1); (j)++) {
        int r, c;
        r = kr + i;
        c = kc + j;
        if (r < 0 || r >= 8 || c < 0 || c >= 8) continue;
        if (!attack[r][c] && !adjacent(r, c, wr, wc)) res = "OTHER";
        if (r == rook_r[0] && c == rook_c[0]) {
          if (rook_r[0] != rook_r[1] && rook_c[0] != rook_c[1] &&
              !adjacent(rook_r[0], rook_c[0], wr, wc))
            res = "OTHER";
        }
        if (r == rook_r[1] && c == rook_c[1]) {
          if (rook_r[0] != rook_r[1] && rook_c[0] != rook_c[1] &&
              !adjacent(rook_r[1], rook_c[1], wr, wc))
            res = "OTHER";
        }
      }
  } else
    res = "OTHER";
  printf("%s\n", res);
  return 0;
}
