#include <bits/stdc++.h>
using namespace std;
int a[10][10];
void getpiece(int tag) {
  int c;
  char s[100], r;
  scanf("%s", s);
  sscanf(s, "%c%d", &r, &c);
  a[r - 'a' + 1][c] = tag;
}
bool ismate(int r, int c) {
  for (int dr = -1; dr <= 1; dr++)
    for (int dc = -1; dc <= 1; dc++)
      if (a[r + dr][c + dc] == 2) return true;
  const int mr[] = {-1, 0, 1, 0};
  const int mc[] = {0, 1, 0, -1};
  for (int o = 0; o < 4; o++) {
    int dr = r, dc = c;
    while (!a[dr += mr[o]][dc += mc[o]])
      ;
    if (a[dr][dc] == 1) return true;
  }
  return false;
}
int main() {
  int r, c;
  try {
    memset(a, 255, sizeof(a));
    for (r = 1; r <= 8; r++)
      for (c = 1; c <= 8; c++) a[r][c] = 0;
    getpiece(1);
    getpiece(1);
    getpiece(2);
    getpiece(3);
    for (r = 1; r <= 8; r++)
      for (c = 1; c <= 8; c++)
        if (a[r][c] == 3) throw a[r][c] = 0;
  } catch (...) {
  }
  if (!ismate(r, c)) return puts("OTHER");
  for (int dr = -1; dr <= 1; dr++)
    for (int dc = -1; dc <= 1; dc++) {
      if (r + dr < 1 || r + dr > 8 || c + dc < 1 || c + dc > 8) continue;
      int t = a[r + dr][c + dc];
      if (t == 2) return puts("OTHER");
      a[r + dr][c + dc] = 3;
      if (!ismate(r + dr, c + dc)) return puts("OTHER");
      a[r + dr][c + dc] = t;
    }
  puts("CHECKMATE");
}
