#include <bits/stdc++.h>
using namespace std;
int a, b, i, j, n, ans, c, d, e, F, g, h;
char in[10];
bool f[10][10], ff[10][10];
int dx[] = {-1, -1, -1, 0, 0, 1, 1, 1, 0};
int dy[] = {-1, 0, 1, -1, 1, -1, 0, 1, 0};
void rook(int x, int y) {
  for (int i = x + 1; i < n; i++) {
    f[i][y] = 1;
    if (ff[i][y]) break;
  }
  for (int i = x - 1; i >= 0; i--) {
    f[i][y] = 1;
    if (ff[i][y]) break;
  }
  for (int i = y + 1; i < n; i++) {
    f[x][i] = 1;
    if (ff[x][i]) break;
  }
  for (int i = y - 1; i >= 0; i--) {
    f[x][i] = 1;
    if (ff[x][i]) break;
  }
}
void king(int x, int y) {
  for (int i = 0; i < n; i++) {
    int xx, yy;
    xx = x + dx[i];
    yy = y + dy[i];
    if (xx < n && xx >= 0 && yy < n && yy >= 0) f[xx][yy] = 1;
  }
}
int main() {
  n = 8;
  scanf("%s", in);
  a = in[0] - 'a';
  b = in[1] - '1';
  scanf("%s", in);
  c = in[0] - 'a';
  d = in[1] - '1';
  scanf("%s", in);
  e = in[0] - 'a';
  F = in[1] - '1';
  ff[a][b] = 1;
  scanf("%s", in);
  g = in[0] - 'a';
  h = in[1] - '1';
  ans = 0;
  for (i = 0; i <= n; i++) {
    int xx, yy;
    xx = g + dx[i];
    yy = h + dy[i];
    if (xx < n && xx >= 0 && yy < n && yy >= 0) {
      memset(f, 0, sizeof(f));
      memset(ff, 0, sizeof(ff));
      ff[xx][yy] = 1;
      ff[a][b] = 1;
      ff[c][d] = 1;
      ff[e][F] = 1;
      rook(a, b);
      rook(c, d);
      king(e, F);
      if (f[xx][yy] == 0) ans = 1;
    }
  }
  if (ans)
    printf("OTHER\n");
  else
    printf("CHECKMATE\n");
  return 0;
}
