#include <bits/stdc++.h>
using namespace std;
int mat[10][10];
pair<int, int> b[2], p, h;
string s;
int dalam(int x, int y) {
  if (1 <= x && x <= 8 && 1 <= y && y <= 8) return 1;
  return 0;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(0);
  cin >> s;
  b[0].first = s[0] - (char)96;
  b[0].second = s[1] - '0';
  cin >> s;
  b[1].first = s[0] - (char)96;
  b[1].second = s[1] - '0';
  cin >> s;
  p.first = s[0] - (char)96;
  p.second = s[1] - '0';
  cin >> s;
  h.first = s[0] - (char)96;
  h.second = s[1] - '0';
  int pola[4][2] = {{0, 1}, {1, 0}, {-1, 0}, {0, -1}};
  int tx, ty;
  for (int i = (1); i != (8 + ((8 - 1) / abs(8 - 1)));
       i += (8 - 1) / abs(8 - 1)) {
    for (int j = (1); j != (8 + ((8 - 1) / abs(8 - 1)));
         j += (8 - 1) / abs(8 - 1)) {
      mat[i][j] = 1;
    }
  }
  for (int j = 0; j < (2); j++) {
    for (int i = 0; i < (4); i++) {
      tx = b[j].first + pola[i][0];
      ty = b[j].second + pola[i][1];
      while (dalam(tx, ty)) {
        if (p.first == tx && p.second == ty) {
          break;
        }
        mat[tx][ty] = 0;
        tx += pola[i][0];
        ty += pola[i][1];
      }
    }
  }
  for (int i = p.first - 1; i <= p.first + 1; i++) {
    for (int j = p.second - 1; j <= p.second + 1; j++) {
      if (dalam(i, j)) {
        mat[i][j] = 0;
      }
    }
  }
  for (int i = h.first - 1; i <= h.first + 1; i++) {
    for (int j = h.second - 1; j <= h.second + 1; j++) {
      if (dalam(i, j)) {
        if (mat[i][j] == 1) {
          cout << "OTHER" << endl;
          return 0;
        }
      }
    }
  }
  cout << "CHECKMATE" << endl;
}
