#include <bits/stdc++.h>
using namespace std;
bool isone[10][10];
int dro[10][10];
int main() {
  int x, y;
  int tx[2], ty[2];
  char str[3];
  for (int i = 0; i < 2; i++) {
    scanf("%s", str);
    tx[i] = str[0] - 'a' + 1;
    ty[i] = str[1] - '1' + 1;
    isone[tx[i]][ty[i]] = true;
  }
  scanf("%s", str);
  x = str[0] - 'a' + 1;
  y = str[1] - '1' + 1;
  isone[x][y] = true;
  for (int dx = -1; dx <= 1; dx++)
    for (int dy = -1; dy <= 1; dy++) dro[x + dx][y + dy]++;
  for (int i = 0; i < 2; i++) {
    for (x = tx[i] + 1; x <= 8; x++) {
      dro[x][ty[i]]++;
      if (isone[x][ty[i]]) break;
    }
    for (x = tx[i] - 1; x >= 1; x--) {
      dro[x][ty[i]]++;
      if (isone[x][ty[i]]) break;
    }
    for (y = ty[i] + 1; y <= 8; y++) {
      dro[tx[i]][y]++;
      if (isone[tx[i]][y]) break;
    }
    for (y = ty[i] - 1; y >= 1; y--) {
      dro[tx[i]][y]++;
      if (isone[tx[i]][y]) break;
    }
  }
  int cx, cy;
  scanf("%s", str);
  cx = str[0] - 'a' + 1;
  cy = str[1] - '1' + 1;
  bool cango = false;
  for (int dx = -1; dx <= 1; dx++)
    for (int dy = -1; dy <= 1; dy++) {
      const int x = cx + dx;
      const int y = cy + dy;
      if (1 <= x and x <= 8 and 1 <= y and y <= 8) {
        if (dro[x][y] == 0) cango = true;
      }
    }
  if (cango) {
    printf("OTHER\n");
  } else
    printf("CHECKMATE\n");
  return 0;
}
