#include <bits/stdc++.h>
using namespace std;
int dx[] = {1, 1, 0, -1, -1, -1, 0, 1}, dy[] = {0, -1, -1, -1, 0, 1, 1, 1};
char board[8][8] = {};
bool checkmate(pair<int, int> bk) {
  bool chk[8][8] = {};
  for (int p = 0; p < 8; p++)
    for (int q = 0; q < 8; q++) {
      if (board[p][q] == '\0') continue;
      int x = q, y = p;
      chk[y][x] = true;
      if (board[y][x] == 'R') {
        for (int i = y + 1; i < 8; i++) {
          if (board[i][x] == '\0')
            chk[i][x] = true;
          else
            break;
        }
        for (int i = y - 1; i >= 0; i--) {
          if (board[i][x] == '\0')
            chk[i][x] = true;
          else
            break;
        }
        for (int j = x + 1; j < 8; j++) {
          if (board[y][j] == '\0')
            chk[y][j] = true;
          else
            break;
        }
        for (int j = x - 1; j >= 0; j--) {
          if (board[y][j] == '\0')
            chk[y][j] = true;
          else
            break;
        }
      } else if (board[y][x] == 'K') {
        for (int i = 0; i < 8; i++) {
          int xx = x + dx[i], yy = y + dy[i];
          if (0 <= xx && xx < 8 && 0 <= yy && yy < 8) {
            if (board[yy][xx] == '\0') chk[yy][xx] = true;
          }
        }
      }
    }
  return chk[bk.first][bk.second];
}
int main() {
  pair<int, int> bk;
  for (int i = 0; i < 4; i++) {
    char s[3];
    cin >> s;
    if (i < 3)
      board[s[0] - 'a'][s[1] - '1'] = (i < 2 ? 'R' : (i < 3 ? 'K' : 'B'));
    else
      bk = make_pair(s[0] - 'a', s[1] - '1');
  }
  bool ok = checkmate(bk);
  for (int i = 0; i < 8; i++) {
    int xx = bk.second + dx[i], yy = bk.first + dy[i];
    if (0 <= xx && xx < 8 && 0 <= yy && yy < 8) {
      char tmp = board[yy][xx];
      board[yy][xx] = '\0';
      if (!checkmate(make_pair(yy, xx))) ok = false;
      board[yy][xx] = tmp;
    }
  }
  cout << (ok ? "CHECKMATE" : "OTHER") << endl;
  return 0;
}
