#include <bits/stdc++.h>
using namespace std;
string s;
bool used[10][10];
int i, j, p1x, p1y, p2x, p2y, wkx, wky, bkx, bky, a, b;
;
int main() {
  memset((used), 0, sizeof(used));
  cin >> s;
  p1x = s[0] - 'a' + 1;
  p1y = s[1] - '0';
  cin >> s;
  p2x = s[0] - 'a' + 1;
  p2y = s[1] - '0';
  cin >> s;
  wkx = s[0] - 'a' + 1;
  wky = s[1] - '0';
  cin >> s;
  bkx = s[0] - 'a' + 1;
  bky = s[1] - '0';
  for ((i) = (0); (i) <= (9); (i)++) {
    used[i][0] = 1;
    used[0][i] = 1;
    used[i][9] = 1;
    used[9][i] = 1;
  }
  a = 1;
  b = 8;
  if (p1x == wkx) {
    if (p1y < wky)
      b = wky;
    else
      a = wky;
  }
  for ((i) = (a); (i) <= (b); (i)++)
    if (i != p1y) used[p1x][i] = 1;
  a = 1;
  b = 8;
  if (p1y == wky) {
    if (p1x < wkx)
      b = wkx;
    else
      a = wkx;
  }
  for ((i) = (a); (i) <= (b); (i)++)
    if (i != p1x) used[i][p1y] = 1;
  a = 1;
  b = 8;
  if (p2x == wkx) {
    if (p2y < wky)
      b = wky;
    else
      a = wky;
  }
  for ((i) = (a); (i) <= (b); (i)++)
    if (i != p2y) used[p2x][i] = 1;
  a = 1;
  b = 8;
  if (p2y == wky) {
    if (p2x < wkx)
      b = wkx;
    else
      a = wkx;
  }
  for ((i) = (a); (i) <= (b); (i)++)
    if (i != p2x) used[i][p2y] = 1;
  for ((i) = (-1); (i) <= (1); (i)++)
    for ((j) = (-1); (j) <= (1); (j)++) used[wkx + i][wky + j] = 1;
  for ((i) = (-1); (i) <= (1); (i)++)
    for ((j) = (-1); (j) <= (1); (j)++)
      if (used[bkx + i][bky + j] == 0) {
        printf("OTHER\n");
        return 0;
      }
  printf("CHECKMATE\n");
  return 0;
}
