#include <bits/stdc++.h>
struct pion {
  int x, y;
} ke[5];
int board[12][12];
void rookblock(int x, int y, int X, int Y) {
  int a = x + 1, b = x - 1;
  int c = y + 1, d = y - 1;
  int stopX = -1, stopY = -1;
  if (X == x) stopY = Y;
  if (Y == y) stopX = X;
  for (int i = 0; i < 8; i++) {
    if (a <= 8) {
      board[a][y] = 1;
      a++;
    }
    if (b >= 0) {
      board[b][y] = 1;
      b--;
    }
    if (c <= 8) {
      board[x][c] = 1;
      c++;
    }
    if (d >= 0) {
      board[x][d] = 1;
      d--;
    }
    if (a - 1 == stopX) a = 20;
    if (b + 1 == stopX) b = -1;
    if (c - 1 == stopY) c = 20;
    if (d + 1 == stopY) d = -1;
  }
}
void kingblock(int x, int y) {
  board[x - 1][y] = 1;
  board[x][y + 1] = 1;
  board[x][y - 1] = 1;
  board[x + 1][y] = 1;
  board[x + 1][y + 1] = 1;
  board[x + 1][y - 1] = 1;
  board[x - 1][y + 1] = 1;
  board[x - 1][y - 1] = 1;
}
void printSekitar(int x, int y) {
  printf("%d", board[x - 1][y]);
  printf("%d", board[x][y + 1]);
  printf("%d", board[x][y - 1]);
  printf("%d", board[x + 1][y]);
  printf("%d", board[x + 1][y + 1]);
  printf("%d", board[x + 1][y - 1]);
  printf("%d", board[x - 1][y + 1]);
  printf("%d", board[x - 1][y - 1]);
}
int checkmate(int x, int y) {
  if (board[x][y] == 1) {
    if (board[x - 1][y] == 1 && board[x][y + 1] == 1 && board[x][y - 1] == 1 &&
        board[x + 1][y] == 1 && board[x + 1][y + 1] == 1 &&
        board[x + 1][y - 1] == 1 && board[x - 1][y + 1] == 1 &&
        board[x - 1][y - 1] == 1)
      return 1;
  }
  return 0;
}
int main() {
  int p[4][3][3];
  for (int i = 0; i <= 9; i++) {
    for (int j = 0; j <= 9; j++) {
      if (i == 0 || j == 0 || i == 9 || j == 9)
        board[i][j] = 1;
      else
        board[i][j] = 0;
    }
  }
  for (int i = 1; i <= 4; i++) {
    char temp;
    int asd;
    scanf("%c%d", &temp, &asd);
    ke[i].x = 9 - asd;
    getchar();
    int x = temp - 'a' + 1;
    ke[i].y = x;
  }
  for (int i = 1; i <= 4; i++) {
    if (i == 2) continue;
  }
  rookblock(ke[1].x, ke[1].y, ke[3].x, ke[3].y);
  rookblock(ke[2].x, ke[2].y, ke[3].x, ke[3].y);
  kingblock(ke[3].x, ke[3].y);
  if (checkmate(ke[4].x, ke[4].y) == 1)
    puts("CHECKMATE");
  else
    puts("OTHER");
}
