#include <bits/stdc++.h>
using namespace std;
template <class T>
inline void checkmin(T& a, const T& b) {
  if (b < a) a = b;
}
template <class T>
inline void checkmax(T& a, const T& b) {
  if (b > a) a = b;
}
template <class T>
inline T sqr(const T& a) {
  return a * a;
}
int B[8][8];
int main() {
  memset((B), (int)0, sizeof(B));
  ;
  char r[5][2], king[5], b_king[5];
  scanf("%s %s %s %s", &r[0], &r[1], &king, &b_king);
  int kx = king[0] - 'a';
  int ky = king[1] - '1';
  for (int i = (-1), _n = (2); i < _n; ++i)
    for (int j = (-1), _n = (2); j < _n; ++j)
      if (kx + i >= 0 && kx + i < 8 && ky + j >= 0 && ky + j < 8) {
        B[kx + i][ky + j]++;
      }
  for (int ir = 0, _n = (2); ir < _n; ++ir) {
    int x = r[ir][0] - 'a';
    int y = r[ir][1] - '1';
    for (int i = (x + 1), _n = (8); i < _n; ++i) {
      B[i][y]++;
      if (kx == i && ky == y) {
        break;
      }
    }
    for (int _n = (x - 1), _a = (0), i = _n; i >= _a; --i) {
      B[i][y]++;
      if (kx == i && ky == y) {
        break;
      }
    }
    for (int j = (y + 1), _n = (8); j < _n; ++j) {
      B[x][j]++;
      if (kx == x && ky == j) {
        break;
      }
    }
    for (int _n = (y - 1), _a = (0), j = _n; j >= _a; --j) {
      B[x][j]++;
      if (kx == x && ky == j) {
        break;
      }
    }
  }
  kx = b_king[0] - 'a';
  ky = b_king[1] - '1';
  bool checkmat = true;
  for (int i = (-1), _n = (2); i < _n; ++i)
    for (int j = (-1), _n = (2); j < _n; ++j)
      if (kx + i >= 0 && kx + i < 8 && ky + j >= 0 && ky + j < 8) {
        if (B[kx + i][ky + j] == 0) {
          checkmat = false;
        }
      }
  printf("%s\n", checkmat ? "CHECKMATE" : "OTHER");
  return 0;
}
