#include <bits/stdc++.h>
using namespace std;
int px[9], py[9];
bool ima(int x, int y) {
  for (int i = 0; i < 3; i++)
    if (px[i] == x && py[i] == y) return true;
  return false;
}
int main() {
  int i, p, s, j, kx, ky, res;
  char c, t;
  bool mark[11][11];
  int dx[9] = {1, 1, 1, 0, 0, 0, -1, -1, -1},
      dy[9] = {1, 0, -1, 1, 0, -1, 1, 0, -1};
  for (i = 0; i < 4; i++) {
    scanf("%c%c", &c, &t);
    px[i] = c - 'a' + 1;
    py[i] = t - '0';
    if (i < 3) scanf(" ");
  }
  for (i = 0; i < 9; i++)
    for (j = 0; j < 9; j++) mark[i][j] = false;
  p = px[0] + 1;
  while (p < 9) {
    mark[p][py[0]] = true;
    if (ima(p, py[0])) break;
    p++;
  }
  p = px[0] - 1;
  while (p > 0) {
    mark[p][py[0]] = true;
    if (ima(p, py[0])) break;
    p--;
  }
  p = py[0] + 1;
  while (p < 9) {
    mark[px[0]][p] = true;
    if (ima(px[0], p)) break;
    p++;
  }
  p = py[0] - 1;
  while (p > 0) {
    mark[px[0]][p] = true;
    if (ima(px[0], p)) break;
    p--;
  }
  p = px[1] + 1;
  while (p < 9) {
    mark[p][py[1]] = true;
    if (ima(p, py[1])) break;
    p++;
  }
  p = px[1] - 1;
  while (p > 0) {
    mark[p][py[1]] = true;
    if (ima(p, py[1])) break;
    p--;
  }
  p = py[1] + 1;
  while (p < 9) {
    mark[px[1]][p] = true;
    if (ima(px[1], p)) break;
    p++;
  }
  p = py[1] - 1;
  while (p > 0) {
    mark[px[1]][p] = true;
    if (ima(px[1], p)) break;
    p--;
  }
  for (s = 0; s < 9; s++) {
    kx = px[2] + dx[s];
    ky = py[2] + dy[s];
    if (kx > 0 && kx < 9 && ky > 0 && ky < 9) mark[kx][ky] = true;
  }
  res = 1;
  for (s = 0; s < 9; s++) {
    kx = px[3] + dx[s];
    ky = py[3] + dy[s];
    if (kx > 0 && kx < 9 && ky > 0 && ky < 9 && !mark[kx][ky]) res = 0;
  }
  if (res)
    printf("CHECKMATE\n");
  else
    printf("OTHER\n");
  return 0;
}
