#include <bits/stdc++.h>
using namespace std;
const int MOVE[8][2] = {{0, -1},  {0, 1},  {-1, 0}, {1, 0},
                        {-1, -1}, {-1, 1}, {1, -1}, {1, 1}};
int n;
int x[4], y[4];
bool used[8][8];
bool visited[8][8];
void visit(int x, int y, int dx, int dy) {
  while (true) {
    x += dx;
    y += dy;
    if (!(0 <= (x) && (x) < 8 && 0 <= (y) && (y) < 8)) {
      break;
    }
    visited[x][y] = true;
    if (used[x][y]) {
      break;
    }
  }
}
int main() {
  for (int i = 0; i < 4; ++i) {
    char c;
    scanf("%c %d ", &c, y + i);
    x[i] = c - 'a';
    y[i]--;
    if (i < 3) {
      used[x[i]][y[i]] = true;
    }
  }
  for (int i = 0; i < 2; ++i) {
    for (int j = 0; j < 4; ++j) {
      visit(x[i], y[i], MOVE[j][0], MOVE[j][1]);
    }
  }
  for (int i = 0; i < 8; ++i) {
    int tx = x[2] + MOVE[i][0];
    int ty = y[2] + MOVE[i][1];
    if ((0 <= (tx) && (tx) < 8 && 0 <= (ty) && (ty) < 8)) {
      visited[tx][ty] = true;
    }
  }
  bool must_win = visited[x[3]][y[3]];
  for (int i = 0; i < 8; ++i) {
    int tx = x[3] + MOVE[i][0];
    int ty = y[3] + MOVE[i][1];
    if ((0 <= (tx) && (tx) < 8 && 0 <= (ty) && (ty) < 8) && !visited[tx][ty]) {
      must_win = false;
      break;
    }
  }
  puts(must_win ? "CHECKMATE" : "OTHER");
}
