#include <bits/stdc++.h>
using namespace std;
const int N = 55;
void fastInOut();
pair<char, char> r1, r2, kw, kb;
int di[9] = {0, 1, -1, 0, 0, 1, -1, 1, -1};
int dj[9] = {0, 0, 0, -1, 1, 1, 1, -1, -1};
bool valid(pair<char, char> p) {
  for (int d = 0; d < 9; d++) {
    if (make_pair((char)(kw.first + di[d]), (char)(kw.second + dj[d])) == p)
      return false;
  }
  return (p.first >= 'a' && p.first <= 'h' && p.second >= '1' &&
          p.second <= '8');
}
bool check(pair<char, char> k, pair<char, char> r) {
  bool mate = false;
  if (k != r) {
    for (int i = 1; i <= 8; i++) {
      if (make_pair((char)(r.first + i), (char)(r.second)) == kw) break;
      mate |= (make_pair((char)(r.first + i), (char)(r.second)) == k);
    }
    for (int i = 1; i <= 8; i++) {
      if (make_pair((char)(r.first - i), (char)(r.second)) == kw) break;
      mate |= (make_pair((char)(r.first - i), (char)(r.second)) == k);
    }
    for (int i = 1; i <= 8; i++) {
      if (make_pair((char)(r.first), (char)(r.second + i)) == kw) break;
      mate |= (make_pair((char)(r.first), (char)(r.second + i)) == k);
    }
    for (int i = 1; i <= 8; i++) {
      if (make_pair((char)(r.first), (char)(r.second - i)) == kw) break;
      mate |= (make_pair((char)(r.first), (char)(r.second - i)) == k);
    }
  }
  return !mate;
}
int main() {
  fastInOut();
  cin >> r1.first >> r1.second >> r2.first >> r2.second >> kw.first >>
      kw.second >> kb.first >> kb.second;
  bool mate = true;
  for (int d = 0; d < 9; d++) {
    pair<char, char> newBK = {kb.first + di[d], kb.second + dj[d]};
    if (!valid(newBK) || newBK == kw) continue;
    if (check(newBK, r1) && check(newBK, r2)) {
      mate = false;
    }
  }
  if (mate)
    cout << "CHECKMATE\n";
  else
    cout << "OTHER\n";
  return 0;
}
void fastInOut() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL), cout.tie(NULL);
}
