#include <bits/stdc++.h>
using namespace std;
bool g[8][8];
bool t[8][8];
int mx[] = {-1, -1, -1, 0, 1, 1, 1, 0};
int my[] = {-1, 0, 1, 1, 1, 0, -1, -1};
pair<int, int> rook[2];
pair<int, int> wk, bk;
void markRook(int a) {
  int x = rook[a].first;
  int y = rook[a].second;
  int i, j;
  for (i = x - 1; i >= 0; --i) {
    g[i][y] = true;
    if (t[i][y]) break;
  }
  for (i = x + 1; i < 8; ++i) {
    g[i][y] = true;
    if (t[i][y]) break;
  }
  for (i = y - 1; i >= 0; --i) {
    g[x][i] = true;
    if (t[x][i]) break;
  }
  for (i = y + 1; i < 8; ++i) {
    g[x][i] = true;
    if (t[x][i]) break;
  }
}
void markKing() {
  int x = wk.first;
  int y = wk.second;
  int nx, ny;
  for (int i = 0; i < 8; ++i) {
    nx = x + mx[i];
    ny = y + my[i];
    if (nx >= 0 && nx < 8 && ny >= 0 && ny < 8) {
      g[nx][ny] = true;
    }
  }
}
bool checkmate() {
  int x, y, nx, ny;
  x = bk.first;
  y = bk.second;
  if (!g[x][y]) return false;
  for (int i = 0; i < 8; ++i) {
    nx = x + mx[i];
    ny = y + my[i];
    if (nx >= 0 && nx < 8 && ny >= 0 && ny < 8 && !g[nx][ny]) return false;
  }
  return true;
}
int main() {
  int x1, x2, x3, x4;
  char y1, y2, y3, y4;
  int i, j;
  scanf("%c%d %c%d %c%d %c%d", &y1, &x1, &y2, &x2, &y3, &x3, &y4, &x4);
  rook[0] = make_pair(x1 - 1, y1 - 'a');
  rook[1] = make_pair(x2 - 1, y2 - 'a');
  wk = make_pair(x3 - 1, y3 - 'a');
  bk = make_pair(x4 - 1, y4 - 'a');
  memset(t, 0, sizeof(t));
  memset(g, 0, sizeof(g));
  t[rook[0].first][rook[0].second] = true;
  t[rook[1].first][rook[1].second] = true;
  t[wk.first][wk.second] = true;
  for (i = 0; i < 2; ++i) {
    markRook(i);
  }
  markKing();
  if (checkmate()) {
    cout << "CHECKMATE" << endl;
  } else {
    cout << "OTHER" << endl;
  }
  return 0;
}
