#include <bits/stdc++.h>
using namespace std;
int middle(int a, int b, int c) {
  int s[3] = {a, b, c};
  sort(s, s + 3);
  return s[1];
}
int main() {
  char a, b, c, d;
  int Rx1, Rx2, Wx, Bx;
  cin >> a >> Rx1 >> b >> Rx2 >> c >> Wx >> d >> Bx;
  int Ry1, Ry2, Wy, By;
  Ry1 = a - 97 + 1;
  Ry2 = b - 97 + 1;
  Wy = c - 97 + 1;
  By = d - 97 + 1;
  int condition = 0;
  for (int i = -1; i <= 1; i++)
    for (int j = -1; j <= 1; j++) {
      int x = Bx + i, y = By + j;
      if (x < 1 || x > 8 || y < 1 || y > 8) continue;
      if (x == Rx1 && y != Ry1 && (Wx != x || middle(Wy, y, Ry1) != Wy))
        continue;
      if (y == Ry1 && x != Rx1 && (Wy != y || middle(Wx, x, Rx1) != Wx))
        continue;
      if (x == Rx2 && y != Ry2 && (Wx != x || middle(Wy, y, Ry2) != Wy))
        continue;
      if (y == Ry2 && x != Rx2 && (Wy != y || middle(Wx, x, Rx2) != Wx))
        continue;
      if (abs(x - Wx) <= 1 && abs(y - Wy) <= 1 && (x != Wx || y != Wy))
        continue;
      condition = 1;
      break;
    }
  if (!condition) {
    cout << "CHECKMATE\n";
  } else {
    cout << "OTHER\n";
  }
  return 0;
}
