#include <bits/stdc++.h>
using namespace std;
const int INF = (1 << 30) - 1;
const long double EPS = 1e-9;
string r1, r2, wk, bk;
void Load() { cin >> r1 >> r2 >> wk >> bk; }
const int dx[8] = {1, 1, 1, 0, 0, -1, -1, -1};
const int dy[8] = {1, 0, -1, 1, -1, 1, 0, -1};
inline bool Good(int x, int y) { return 1 <= x && x <= 8 && 1 <= y && y <= 8; }
const int drx[4] = {1, 0, 0, -1};
const int dry[4] = {0, 1, -1, 0};
inline bool Go(int x, int y) {
  if (!Good(x, y)) return false;
  int kx = wk[0] - 'a' + 1;
  int ky = wk[1] - '0';
  for (int i = 0; i < 8; i++)
    if (kx + dx[i] == x && ky + dy[i] == y) {
      return false;
    }
  int rx = r1[0] - 'a' + 1;
  int ry = r1[1] - '0';
  if (rx != x || ry != y)
    for (int i = 0; i < 4; i++)
      for (int j = 0; j < 8; j++) {
        int nx = rx + drx[i] * j;
        int ny = ry + dry[i] * j;
        if (!Good(nx, ny)) continue;
        if (nx == kx && ny == ky) break;
        if (nx == x && ny == y) {
          return false;
        }
      }
  rx = r2[0] - 'a' + 1;
  ry = r2[1] - '0';
  if (rx != x || ry != y)
    for (int i = 0; i < 4; i++)
      for (int j = 0; j < 8; j++) {
        int nx = rx + drx[i] * j;
        int ny = ry + dry[i] * j;
        if (!Good(nx, ny)) continue;
        if (nx == kx && ny == ky) break;
        if (nx == x && ny == y) {
          return false;
        }
      }
  return true;
}
void Solve() {
  int x = bk[0] - 'a' + 1;
  int y = bk[1] - '0';
  if (Go(x, y)) {
    puts("OTHER");
    return;
  }
  for (int i = 0; i < 8; i++)
    if (Go(x + dx[i], y + dy[i])) {
      puts("OTHER");
      return;
    }
  puts("CHECKMATE");
}
int main() {
  Load();
  Solve();
  return 0;
}
