#include <bits/stdc++.h>
using namespace std;
void scan(pair<int, int> &i) {
  char c;
  cin >> c;
  int t;
  cin >> t;
  i = pair<int, int>(c - 'a', t - 1);
}
pair<int, int> rk1, rk2, white, black;
bool between(int a, int m, int b) {
  return (m > a && m < b) || (m > b && m < a);
}
bool threat(pair<int, int> &rook, pair<int, int> &king) {
  return ((rook.first == king.first &&
           !(white.first == king.first &&
             between(rook.second, white.second, king.second))) ||
          (rook.second == king.second &&
           !(white.second == king.second &&
             between(rook.first, white.first, king.first)))) &&
         rook != king;
}
bool threatk(pair<int, int> &k1, pair<int, int> &k2) {
  return abs(k1.first - k2.first) <= 1 && abs(k1.second - k2.second) <= 1;
}
bool in(pair<int, int> &t) {
  return t.first >= 0 && t.first < 8 && t.second >= 0 && t.second < 8;
}
int main() {
  scan(rk1);
  scan(rk2);
  scan(white);
  scan(black);
  for (int i = -1; i <= 1; i++) {
    for (int j = -1; j <= 1; j++) {
      pair<int, int> pos = pair<int, int>(black.first + i, black.second + j);
      if (in(pos) && !threat(rk1, pos) && !threat(rk2, pos) &&
          !threatk(white, pos)) {
        cout << "OTHER";
        return 0;
      }
    }
  }
  cout << "CHECKMATE";
}
