#include <bits/stdc++.h>
using namespace std;
const int N = 8;
int a[N][N];
void re(int& x, int& y) {
  char cx;
  scanf("%c%d%*c", &cx, &y);
  x = cx - 'a';
  --y;
}
const int dx[8] = {-1, 0, 0, 1, 1, -1, -1, 1};
const int dy[8] = {0, -1, 1, 0, 1, -1, 1, -1};
int main() {
  int ax, ay, bx, by, cx, cy, x, y;
  re(ax, ay);
  re(bx, by);
  re(cx, cy);
  for (int d = 0; d < 4; ++d) {
    for (int i = 1; i < N; ++i) {
      int nx = ax + dx[d] * i, ny = ay + dy[d] * i;
      if (nx < 0 || nx == N || ny < 0 || ny == N) break;
      ++a[nx][ny];
      if (nx == cx && ny == cy) break;
    }
  }
  for (int d = 0; d < 4; ++d) {
    for (int i = 1; i < N; ++i) {
      int nx = bx + dx[d] * i, ny = by + dy[d] * i;
      if (nx < 0 || nx == N || ny < 0 || ny == N) break;
      ++a[nx][ny];
      if (nx == cx && ny == cy) break;
    }
  }
  for (int d = 0; d < 8; ++d) {
    int nx = cx + dx[d];
    int ny = cy + dy[d];
    if (nx >= 0 && nx < N && ny >= 0 && ny < N) a[nx][ny]++;
  }
  re(x, y);
  if (!a[x][y]) {
    puts("OTHER");
    return 0;
  }
  for (int d = 0; d < 8; ++d) {
    int nx = x + dx[d];
    int ny = y + dy[d];
    if (nx >= 0 && nx < N && ny >= 0 && ny < N) {
      if (!a[nx][ny] || (nx == cx && ny == cy)) {
        puts("OTHER");
        return 0;
      }
    }
  }
  puts("CHECKMATE");
}
