#include <bits/stdc++.h>
using namespace std;
int dx[4] = {1, -1, 0, 0};
int dy[4] = {0, 0, 1, -1};
bool c(int i) { return (i >= 0 && i < 8); }
int main(void) {
  int i, j, an, k, l;
  string ans[2] = {"CHECKMATE", "OTHER"};
  int b[8][8];
  char ca, cd;
  int a[4], d[4];
  for (i = 0; i < 4; i++)
    scanf(" %c %c", &ca, &cd), a[i] = ca - 'a', d[i] = cd - '1';
  memset(b, 0, sizeof(b));
  for (i = 0; i < 8; i++)
    for (j = 0; j < 8; j++) {
      if ((abs(a[2] - i) < 2) && (abs(d[2] - j) < 2)) b[i][j] = 1;
    }
  for (l = 0; l < 2; l++) {
    for (k = 0; k < 4; k++) {
      i = a[l] + dx[k];
      j = d[l] + dy[k];
      while (c(i) && c(j) && (!(a[2] == i && d[2] == j)))
        b[i][j] = 1, i += dx[k], j += dy[k];
    }
  }
  an = 0;
  for (i = -1; i < 2; i++)
    for (j = -1; j < 2; j++)
      if (c(a[3] + i) && c(d[3] + j))
        if (!(b[a[3] + i][d[3] + j])) an = 1;
  cout << ans[an] << '\n';
  return 0;
}
