#include <bits/stdc++.h>
#pragma GCC optimize(2)
using namespace std;
const int dx[] = {1, 1, 1, 0, 0, -1, -1, -1, 0};
const int dy[] = {1, 0, -1, 1, -1, 1, 0, -1, 0};
pair<int, int> w1, w2, wk, bk;
inline void InPut(pair<int, int> &MyPair) {
  string s;
  cin >> s;
  MyPair = make_pair(s[0] - 'a', s[1] - '1');
  return;
}
bool bt(pair<int, int> rp, pair<int, int> kp) {
  if (rp.first != kp.first && rp.second != kp.second) return false;
  if (rp.first == kp.first && wk.first == rp.first &&
      wk.second >= min(rp.second, kp.second) &&
      wk.second <= max(rp.second, kp.second))
    return false;
  if (rp.second == kp.second && wk.second == rp.second &&
      wk.first >= min(rp.first, kp.first) &&
      wk.first <= max(rp.first, kp.first))
    return false;
  return true;
}
bool KO(pair<int, int> kp) {
  if (kp != w1 && bt(w1, kp)) return true;
  if (kp != w2 && bt(w2, kp)) return true;
  if (abs(wk.first - kp.first) <= 1 && abs(wk.second - kp.second) <= 1)
    return true;
  return false;
}
int main() {
  InPut(w1);
  InPut(w2);
  InPut(wk);
  InPut(bk);
  bool flag = true;
  for (int i = 0; i < 9; i++) {
    int nx = bk.first + dx[i];
    int ny = bk.second + dy[i];
    if (nx < 0 || nx >= 8 || ny < 0 || ny >= 8) continue;
    if (!KO(make_pair(nx, ny))) {
      flag = false;
      break;
    }
  }
  if (!flag) {
    cout << "OTHER\n";
    return 0;
  };
  cout << "CHECKMATE\n";
  return 0;
}
