#include <bits/stdc++.h>
using namespace std;
int c[8][8], ac[8][8], dx[8] = {-1, 1, 0, 0, -1, -1, 1, 1},
                       dy[8] = {0, 0, -1, 1, -1, 1, -1, 1};
int main() {
  memset(ac, 0, sizeof(ac));
  string wr1, wr2, wk, bk;
  cin >> wr1 >> wr2 >> wk >> bk;
  int wr1x = 8 - (wr1[1] - '0'), wr1y = wr1[0] - 'a', wr2x = 8 - (wr2[1] - '0'),
      wr2y = wr2[0] - 'a', wkx = 8 - (wk[1] - '0'), wky = wk[0] - 'a',
      bkx = 8 - (bk[1] - '0'), bky = bk[0] - 'a';
  memset(c, 0, sizeof(c));
  c[wr1x][wr1y] = 1;
  c[wr2x][wr2y] = 1;
  c[wkx][wky] = 1;
  for (int d = 0; d < 4; d++) {
    int x = wr1x + dx[d], y = wr1y + dy[d];
    while (x >= 0 && x < 8 && y >= 0 && y < 8 && c[x][y] == 0) {
      ac[x][y]++;
      x += dx[d];
      y += dy[d];
    }
    if (x >= 0 && x < 8 && y >= 0 && y < 8 && c[x][y] == 1) ac[x][y]++;
  }
  for (int d = 0; d < 4; d++) {
    int x = wr2x + dx[d], y = wr2y + dy[d];
    while (x >= 0 && x < 8 && y >= 0 && y < 8 && c[x][y] == 0) {
      ac[x][y]++;
      x += dx[d];
      y += dy[d];
    }
    if (x >= 0 && x < 8 && y >= 0 && y < 8 && c[x][y] == 1) ac[x][y]++;
  }
  for (int d = 0; d < 8; d++) {
    int x = wkx + dx[d], y = wky + dy[d];
    if (x >= 0 && x < 8 && y >= 0 && y < 8) ac[x][y]++;
  }
  bool CHECKMATE = true;
  if (ac[bkx][bky]) {
    for (int d = 0; d < 8; d++) {
      int x = bkx + dx[d], y = bky + dy[d];
      if (x >= 0 && x < 8 && y >= 0 && y < 8 && ac[x][y] == 0) {
        CHECKMATE = false;
        break;
      }
    }
  } else
    CHECKMATE = false;
  cout << (CHECKMATE ? "CHECKMATE" : "OTHER") << endl;
  return 0;
}
