#include <bits/stdc++.h>
using namespace std;
pair<int, int> pos() {
  char s[10];
  if (scanf("%s", s) == EOF) return make_pair(-1, -1);
  return make_pair(s[0] - 'a', s[1] - '1');
}
int main() {
  while (1) {
    pair<int, int> r1 = pos();
    if (r1.first == -1) break;
    pair<int, int> r2 = pos();
    pair<int, int> k1 = pos();
    pair<int, int> k2 = pos();
    set<pair<int, int> > occ, att;
    occ.insert(r1);
    occ.insert(r2);
    occ.insert(k1);
    for (int x = r1.first, y = r1.second; x < 8; x++) {
      pair<int, int> p = make_pair(x, y);
      if (p == r1) continue;
      att.insert(p);
      if (occ.count(p)) break;
    }
    for (int x = r1.first, y = r1.second; x >= 0; x--) {
      pair<int, int> p = make_pair(x, y);
      if (p == r1) continue;
      att.insert(p);
      if (occ.count(p)) break;
    }
    for (int x = r1.first, y = r1.second; y < 8; y++) {
      pair<int, int> p = make_pair(x, y);
      if (p == r1) continue;
      att.insert(p);
      if (occ.count(p)) break;
    }
    for (int x = r1.first, y = r1.second; y >= 0; y--) {
      pair<int, int> p = make_pair(x, y);
      if (p == r1) continue;
      att.insert(p);
      if (occ.count(p)) break;
    }
    for (int x = r2.first, y = r2.second; x < 8; x++) {
      pair<int, int> p = make_pair(x, y);
      if (p == r2) continue;
      att.insert(p);
      if (occ.count(p)) break;
    }
    for (int x = r2.first, y = r2.second; x >= 0; x--) {
      pair<int, int> p = make_pair(x, y);
      if (p == r2) continue;
      att.insert(p);
      if (occ.count(p)) break;
    }
    for (int x = r2.first, y = r2.second; y < 8; y++) {
      pair<int, int> p = make_pair(x, y);
      if (p == r2) continue;
      att.insert(p);
      if (occ.count(p)) break;
    }
    for (int x = r2.first, y = r2.second; y >= 0; y--) {
      pair<int, int> p = make_pair(x, y);
      if (p == r2) continue;
      att.insert(p);
      if (occ.count(p)) break;
    }
    for (int i = -1; i <= 1; i++)
      for (int j = -1; j <= 1; j++)
        if (i || j) {
          pair<int, int> p = make_pair(k1.first + i, k1.second + j);
          if (p.first < 0 || p.first >= 8 || p.second < 0 || p.second >= 8)
            continue;
          att.insert(p);
        }
    if (!att.count(k2)) {
      puts("OTHER");
      goto finish;
    }
    for (int i = -1; i <= 1; i++)
      for (int j = -1; j <= 1; j++)
        if (i || j) {
          pair<int, int> p = make_pair(k2.first + i, k2.second + j);
          if (p.first < 0 || p.first >= 8 || p.second < 0 || p.second >= 8)
            continue;
          if (!att.count(p)) {
            puts("OTHER");
            goto finish;
          }
        }
    puts("CHECKMATE");
  finish:;
  }
}
