#include <bits/stdc++.h>
using namespace std;
inline void get(int& x, int& y) {
  char c;
  scanf(" %c%d", &c, &y), x = c - 'a' + 1;
}
inline int mid(int x, int y, int z) {
  int s[3] = {x, y, z};
  sort(s, s + 3);
  return s[1];
}
int main() {
  int rx1, ry1, rx2, ry2, wx, wy, bx, by;
  get(rx1, ry1), get(rx2, ry2), get(wx, wy), get(bx, by);
  for (int i = -1; i <= 1; ++i)
    for (int j = -1; j <= 1; ++j) {
      int x = bx + i, y = by + j;
      if (x < 1 or x > 8 or y < 1 or y > 8) continue;
      if (x == rx1 and y != ry1 and (wx != x or mid(wy, y, ry1) != wy))
        continue;
      if (y == ry1 and x != rx1 and (wy != y or mid(wx, x, rx1) != wx))
        continue;
      if (x == rx2 and y != ry2 and (wx != x or mid(wy, y, ry2) != wy))
        continue;
      if (y == ry2 and x != rx2 and (wy != y or mid(wx, x, rx2) != wx))
        continue;
      if (abs(x - wx) <= 1 and abs(y - wy) <= 1 and (x != wx or y != wy))
        continue;
      return puts("OTHER") * 0;
    }
  puts("CHECKMATE");
}
