#include <bits/stdc++.h>
int d[8][2] = {-1, -1, -1, 0, -1, 1, 0, 1, 1, 1, 1, 0, 1, -1, 0, -1},
    d1[4][2] = {-1, 0, 0, 1, 1, 0, 0, -1};
bool danger;
struct node {
  int x, y;
} che[2];
node w, b;
bool is[2], flag[10][10];
int vis[10][10];
bool isdanger() {
  int i, j, ii, jj, k, t;
  memset(vis, 0, sizeof(vis));
  for (i = 0; i < 2; i++)
    if (is[i]) vis[che[i].x][che[i].y] = 1;
  vis[w.x][w.y] = 1;
  vis[b.x][b.y] = 2;
  for (t = 0; t < 2; t++) {
    if (is[t] == false) continue;
    for (k = 0; k < 4; k++) {
      ii = che[t].x;
      jj = che[t].y;
      while (1) {
        ii += d1[k][0];
        jj += d1[k][1];
        if (ii <= 0 || ii > 8 || jj <= 0 || jj > 8) break;
        if (vis[ii][jj] == 1) break;
        if (vis[ii][jj] == 2) return true;
      }
    }
  }
  i = w.x;
  j = w.y;
  for (k = 0; k < 8; k++) {
    ii = i + d[k][0];
    jj = j + d[k][1];
    if (ii <= 0 || ii > 8 || jj <= 0 || jj > 8) continue;
    if (vis[ii][jj] == 2) return true;
  }
  return false;
}
void solve() {
  danger = false;
  memset(is, true, sizeof(is));
  if (isdanger()) danger = true;
  if (danger) {
    int i, j, ii, jj, tx, ty, k, t;
    i = b.x;
    j = b.y;
    tx = b.x;
    ty = b.y;
    for (k = 0; k < 8; k++) {
      ii = i + d[k][0];
      jj = j + d[k][1];
      if (ii <= 0 || ii > 8 || jj <= 0 || jj > 8) continue;
      vis[b.x][b.y] = 0;
      vis[ii][jj] = 2;
      memset(is, true, sizeof(is));
      for (t = 0; t < 2; t++)
        if (ii == che[t].x && jj == che[t].y) {
          is[t] = false;
        }
      b.x = ii;
      b.y = jj;
      if (isdanger() == false) {
        danger = false;
        break;
      }
      b.x = tx;
      b.y = ty;
    }
  }
  if (danger)
    printf("CHECKMATE\n");
  else
    printf("OTHER\n");
}
int main() {
  char str[10];
  while (scanf("%s", str) != EOF) {
    che[0].x = str[0] - 'a' + 1;
    che[0].y = str[1] - '0';
    scanf("%s", str);
    che[1].x = str[0] - 'a' + 1;
    che[1].y = str[1] - '0';
    scanf("%s", str);
    w.x = str[0] - 'a' + 1;
    w.y = str[1] - '0';
    scanf("%s", str);
    b.x = str[0] - 'a' + 1;
    b.y = str[1] - '0';
    solve();
  }
  return 0;
}
