#include <bits/stdc++.h>
bool fix(int i, int j) {
  if (i >= 1 && i <= 8 && j >= 1 && j <= 8) return 1;
  return 0;
}
int main() {
  int p[9][2] = {{0, 0},  {0, 1},  {0, -1}, {1, 1},  {1, 0},
                 {1, -1}, {-1, 1}, {-1, 0}, {-1, -1}};
  char r1, r2, k1, k2;
  int rx1, rx2, kx1, kx2, ry1, ry2, ky1, ky2, x, y, find, g[10][10], i;
  scanf("%c%d %c%d %c%d %c%d", &r1, &ry1, &r2, &ry2, &k1, &ky1, &k2, &ky2);
  rx1 = r1 - 'a' + 1;
  rx2 = r2 - 'a' + 1;
  kx1 = k1 - 'a' + 1;
  kx2 = k2 - 'a' + 1;
  memset(g, 0, sizeof(g));
  x = rx1 + 1;
  y = ry1;
  while (fix(x, y) && (x != kx1 || y != ky1) && (x != rx2 || y != ry2)) {
    g[x][y] = 1;
    x++;
  }
  x = rx1 - 1;
  y = ry1;
  while (fix(x, y) && (x != kx1 || y != ky1) && (x != rx2 || y != ry2)) {
    g[x][y] = 1;
    x--;
  }
  x = rx1;
  y = ry1 + 1;
  while (fix(x, y) && (x != kx1 || y != ky1) && (x != rx2 || y != ry2)) {
    g[x][y] = 1;
    y++;
  }
  x = rx1;
  y = ry1 - 1;
  while (fix(x, y) && (x != kx1 || y != ky1) && (x != rx2 || y != ry2)) {
    g[x][y] = 1;
    y--;
  }
  x = rx2 + 1;
  y = ry2;
  while (fix(x, y) && (x != kx1 || y != ky1) && (x != rx1 || y != ry1)) {
    g[x][y] = 1;
    x++;
  }
  x = rx2 - 1;
  y = ry2;
  while (fix(x, y) && (x != kx1 || y != ky1) && (x != rx1 || y != ry1)) {
    g[x][y] = 1;
    x--;
  }
  x = rx2;
  y = ry2 + 1;
  while (fix(x, y) && (x != kx1 || y != ky1) && (x != rx1 || y != ry1)) {
    g[x][y] = 1;
    y++;
  }
  x = rx2;
  y = ry2 - 1;
  while (fix(x, y) && (x != kx1 || y != ky1) && (x != rx1 || y != ry1)) {
    g[x][y] = 1;
    y--;
  }
  for (i = 0; i <= 8; ++i) {
    x = kx1 + p[i][0];
    y = ky1 + p[i][1];
    if (fix(x, y)) g[x][y] = 1;
  }
  if (rx1 == rx2 || ry1 == ry2) g[rx1][ry1] = g[rx2][ry2] = 1;
  find = 0;
  for (i = 0; i <= 8; ++i) {
    x = kx2 + p[i][0];
    y = ky2 + p[i][1];
    if (fix(x, y) && g[x][y] == 0) {
      find = 1;
      break;
    }
  }
  if (find)
    printf("OTHER\n");
  else
    printf("CHECKMATE\n");
  return 0;
}
