#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:16777216")
using namespace std;
template <class T>
void pv(T a, T b) {
  for (T i = a; i != b; ++i) cout << *i << " ";
  cout << endl;
}
char tab[10][10];
int tx[2], ty[2];
int rx, ry;
void putKing(int x, int y) {
  for (int(vx) = (-1); (vx) < (+2); (vx)++)
    for (int(vy) = (-1); (vy) < (+2); (vy)++) {
      tab[x + vx][y + vy]++;
    }
}
void putTower(int x, int y) {
  int vx[] = {0, 0, 1, -1}, vy[] = {1, -1, 0, 0};
  for (int(d) = (0); (d) < (4); (d)++) {
    int px = x, py = y;
    while (0 <= px && px < 10 && 0 <= py && py < 10 && (px != rx || py != ry)) {
      tab[px][py]++;
      px += vx[d], py += vy[d];
    }
    tab[x][y]--;
  }
}
bool mate(int x, int y) {
  for (int(vx) = (-1); (vx) < (+2); (vx)++)
    for (int(vy) = (-1); (vy) < (+2); (vy)++) {
      int px = x + vx, py = y + vy;
      if (1 <= px && px <= 8 && 1 <= py && py <= 8) {
        if (!tab[px][py]) return false;
      }
    }
  return true;
}
int main() {
  char tmp[10];
  for (int(i) = (0); (i) < (2); (i)++)
    scanf("%s", tmp), tx[i] = tmp[0] - 'a' + 1, ty[i] = tmp[1] - '0';
  scanf("%s", tmp), rx = tmp[0] - 'a' + 1, ry = tmp[1] - '0';
  for (int(i) = (0); (i) < (2); (i)++) putTower(tx[i], ty[i]);
  putKing(rx, ry);
  scanf("%s", tmp);
  if (mate(tmp[0] - 'a' + 1, tmp[1] - '0'))
    printf("CHECKMATE\n");
  else
    printf("OTHER\n");
  return 0;
}
