#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:10000000")
using namespace std;
template <typename T>
inline T abs(T a) {
  return ((a < 0) ? -a : a);
}
template <typename T>
inline T sqr(T a) {
  return a * a;
}
const int INF = (int)1E9 + 7;
const long double EPS = 1E-9;
const long double PI = 3.1415926535897932384626433832795;
pair<int, int> get() {
  string s;
  cin >> s;
  return pair<int, int>(tolower(s[0]) - 'a', s[1] - '1');
}
const int dx[] = {1, -1, 0, 0, 1, 1, -1, -1};
const int dy[] = {0, 0, 1, -1, -1, 1, -1, 1};
bool in(pair<int, int> a) {
  return 0 <= a.first && a.first < 8 && 0 <= a.second && a.second < 8;
}
pair<int, int> a, b, c, d;
bool isBeat(pair<int, int> ca, pair<int, int> cd, bool king) {
  if (ca == cd) return false;
  for (int i = 0; i < int(8); ++i) {
    if (!king && i >= 4) break;
    for (int leng = 1; leng <= int(10); ++leng) {
      if (king && leng > 1) break;
      pair<int, int> next(cd.first + dx[i] * leng, cd.second + dy[i] * leng);
      if (next == ca) return true;
      if (next == a || next == b || next == c) break;
    }
  }
  return false;
}
bool ok(pair<int, int> cur) {
  return isBeat(cur, a, false) || isBeat(cur, b, false) || isBeat(cur, c, true);
}
void kill() {
  puts("OTHER");
  exit(0);
}
int main() {
  a = get();
  b = get();
  c = get();
  d = get();
  if (!ok(d)) {
    kill();
  }
  for (int i = 0; i < int(8); ++i) {
    pair<int, int> next(d.first + dx[i], d.second + dy[i]);
    if (in(next) && !ok(next)) kill();
  }
  puts("CHECKMATE");
  return 0;
}
