#include <bits/stdc++.h>
using namespace std;
void fastInOut();
const int d1[] = {0, 0, 0, 1, -1, -1, -1, 1, 1};
const int d2[] = {0, 1, -1, 0, 0, -1, 1, -1, 1};
const int r1[] = {-1, 1, 0, 0};
const int r2[] = {0, 0, -1, 1};
const int K = 8;
int pc[4][2];
bool valid(int i, int j) { return i >= 0 && i < K && j >= 0 && j < K; }
bool save(int i, int j) {
  for (int a = 0; a <= K; ++a)
    if (pc[2][0] + d1[a] == i && pc[2][1] + d2[a] == j) return 0;
  bool sm = (pc[0][0] == pc[1][0] || pc[0][1] == pc[1][1]);
  for (int r = 0; r < 2; ++r) {
    if (pc[r][0] == i && pc[r][1] == j) {
      if (sm) return 0;
      continue;
    }
    for (int d = 0; d < 4; ++d) {
      int ii = pc[r][0] + r1[d], jj = pc[r][1] + r2[d];
      while (valid(ii, jj) && (ii != pc[2][0] || jj != pc[2][1])) {
        if (ii == i && jj == j) return 0;
        ii += r1[d], jj += r2[d];
      }
    }
  }
  return 1;
}
bool solve() {
  for (int a = 0; a <= K; ++a) {
    int ii = pc[3][0] + d1[a], jj = pc[3][1] + d2[a];
    if (valid(ii, jj) && save(ii, jj)) return 0;
  }
  return 1;
}
int main() {
  fastInOut();
  string s;
  for (int i = 0; i < 4; ++i)
    cin >> s, pc[i][0] = s[0] - 'a', pc[i][1] = s[1] - '1';
  cout << (solve() ? "CHECKMATE" : "OTHER");
  return 0;
}
void fastInOut() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL), cout.tie(NULL);
}
