#include <bits/stdc++.h>
void set_p(int board[8][8]) {
  int i, j, k, l;
  for (i = 0; i < 8; i++)
    for (j = 0; j < 8; j++)
      if (!(board[i][j] > 0 || board[i][j] == -4)) board[i][j] = 0;
  for (i = 0; i < 8; i++)
    for (j = 0; j < 8; j++)
      if (board[i][j] > 0) {
        if (board[i][j] == 1) {
          for (k = j - 1; k >= 0 && board[i][k] <= 0; k--) board[i][k] = -1;
          for (k = j + 1; k < 8 && board[i][k] <= 0; k++) board[i][k] = -1;
          for (k = i - 1; k >= 0 && board[k][j] <= 0; k--) board[k][j] = -1;
          for (k = i + 1; k < 8 && board[k][j] <= 0; k++) board[k][j] = -1;
        } else if (board[i][j] == 2) {
          for (k = i - 1; k <= i + 1; k++)
            for (l = j - 1; l <= j + 1; l++)
              if (k >= 0 && k < 8 && l >= 0 && l < 8 && board[k][l] <= 0)
                board[k][l] = -1;
        }
      }
}
void cpy_board(int dest[8][8], int source[8][8]) {
  int i, j;
  for (i = 0; i < 8; i++)
    for (j = 0; j < 8; j++) dest[i][j] = source[i][j];
}
int main() {
  int x, y;
  char _x;
  int i, j;
  int other = 0;
  int board[8][8];
  int temp_board[8][8];
  for (i = 0; i < 8; i++)
    for (j = 0; j < 8; j++) board[i][j] = 0;
  scanf("%c%d ", &_x, &y);
  x = _x - 'a';
  y--;
  board[x][y] = 1;
  scanf("%c%d ", &_x, &y);
  x = _x - 'a';
  y--;
  board[x][y] = 1;
  scanf("%c%d ", &_x, &y);
  x = _x - 'a';
  y--;
  board[x][y] = 2;
  scanf("%c%d", &_x, &y);
  x = _x - 'a';
  y--;
  board[x][y] = -4;
  set_p(board);
  if (board[x][y] == -4)
    printf("OTHER\n");
  else {
    other = 0;
    for (i = x - 1; i <= x + 1; i++)
      for (j = y - 1; j <= y + 1; j++) {
        if (i >= 0 && i < 8 && j >= 0 && j < 8)
          if (board[i][j] == 0) other = 1;
        if (i >= 0 && i < 8 && j >= 0 && j < 8 && board[i][j] == 1) {
          cpy_board(temp_board, board);
          temp_board[x][y] = 0;
          temp_board[i][j] = -4;
          set_p(temp_board);
          other = other || (temp_board[i][j] == -4);
        }
      }
    if (other)
      printf("OTHER\n");
    else
      printf("CHECKMATE\n");
  }
  return 0;
}
