#include <bits/stdc++.h>
using namespace std;
int R[10], C[10];
int g[10][10];
bool isvalid(int r1, int c1, int r2, int c2) {
  if ((r1 == r2) && (c1 == c2)) return true;
  if (c1 == c2) {
    if (r1 > r2) swap(r1, r2);
    r1++;
    while (r1 < r2) {
      if (g[r1][c1]) return true;
      r1++;
    }
    return false;
  }
  if (r1 == r2) {
    if (c1 > c2) swap(c1, c2);
    c1++;
    while (c1 < c2) {
      if (g[r1][c1]) return true;
      c1++;
    }
    return false;
  }
  return true;
}
bool iskill(int r1, int c1, int r2, int c2) {
  if (abs(r1 - r2) > 1) return false;
  if (abs(c1 - c2) > 1) return false;
  return true;
}
string getv(int i, int j) {
  int dx, dy;
  for (dx = -1; dx < 2; ++dx)
    for (dy = -1; dy < 2; ++dy) {
      int tx = abs(dx), ty = abs(dy);
      tx = i + dx;
      ty = j + dy;
      if (tx < 0 || ty < 0 || tx >= 8 || ty >= 8) continue;
      if (g[tx][ty] == 3) continue;
      if (!isvalid(R[1], C[1], tx, ty)) continue;
      if (!isvalid(R[2], C[2], tx, ty)) continue;
      if (iskill(tx, ty, R[3], C[3])) continue;
      return "OTHER";
    }
  return "CHECKMATE";
}
int main() {
  char ch1[10], ch2[10], ch3[10], ch4[10];
  memset((g), (0), sizeof(g));
  int n;
  scanf("%s%s%s%s", ch1, ch2, ch3, ch4);
  R[1] = ch1[1] - '1';
  C[1] = ch1[0] - 'a';
  g[R[1]][C[1]] = 1;
  R[2] = ch2[1] - '1';
  C[2] = ch2[0] - 'a';
  g[R[2]][C[2]] = 2;
  R[3] = ch3[1] - '1';
  C[3] = ch3[0] - 'a';
  g[R[3]][C[3]] = 3;
  R[4] = ch4[1] - '1';
  C[4] = ch4[0] - 'a';
  printf("%s\n", getv(R[4], C[4]).c_str());
  return 0;
}
