#include <bits/stdc++.h>
using namespace std;
bool OCC[10][10], COV[10][10];
int R[3], C[3], KR, KC;
void handle_input() {
  string s;
  for (int i = 0; i < 3; i++) {
    cin >> s;
    R[i] = s[0] - 'a' + 1;
    C[i] = s[1] - '0';
    OCC[R[i]][C[i]] = true;
  }
  cin >> s;
  KR = s[0] - 'a' + 1;
  KC = s[1] - '0';
}
int dr[] = {-1, 0, 1, 0};
int dc[] = {0, -1, 0, 1};
void cover_rook(int r, int c) {
  for (int i = 0; i < 4; i++) {
    int nr = r + dr[i];
    int nc = c + dc[i];
    while (!OCC[nr][nc]) {
      COV[nr][nc] = true;
      nr += dr[i];
      nc += dc[i];
    }
    COV[nr][nc] = true;
  }
}
void cover_king(int r, int c) {
  for (int i = -1; i <= 1; i++)
    for (int j = -1; j <= 1; j++)
      if (i != 0 || j != 0) COV[r + i][c + j] = true;
}
int main() {
  for (int i = 0; i < 10; i++) {
    OCC[i][0] = OCC[i][9] = OCC[0][i] = OCC[9][i] = true;
    COV[i][0] = COV[i][9] = COV[0][i] = COV[9][i] = true;
  }
  handle_input();
  cover_rook(R[0], C[0]);
  cover_rook(R[1], C[1]);
  cover_king(R[2], C[2]);
  bool ok = false;
  for (int i = -1; i <= 1; i++)
    for (int j = -1; j <= 1; j++)
      if (!COV[KR + i][KC + j]) ok = true;
  if (ok)
    cout << "OTHER" << endl;
  else
    cout << "CHECKMATE" << endl;
}
