#include <bits/stdc++.h>
using namespace std;
bool h(int a, int b, int c, int d, int e, int f) {
  if (a == c) {
    if (b > d) swap(b, d);
    return (a == e && b < f && f < d);
  } else if (b == d) {
    if (a > c) swap(a, c);
    return (b == f && a < e && e < c);
  } else
    return false;
}
int main(void) {
  char s[32];
  scanf("%s %s %s %s", s, s + 2, s + 4, s + 6);
  bool f = false, g[128][128] = {{false}};
  for (int i = -1; i < 2; ++i)
    for (int j = -1; j < 2; ++j) g[s[4] + i][s[5] + j] = true;
  for (int i = -1; i < 2; ++i)
    for (int j = -1; j < 2; ++j) {
      int u = s[6] + i, v = s[7] + j;
      if ((u >= 'a' && u < 'a' + 8 && v >= '1' && v <= '8') &&
          !((!(u == s[0] && v == s[1]) && (u == s[0] || v == s[1]) &&
             !h(s[0], s[1], u, v, s[2], s[3]) &&
             !h(s[0], s[1], u, v, s[4], s[5])) ||
            (!(u == s[2] && v == s[3]) && (u == s[2] || v == s[3]) &&
             !h(s[2], s[3], u, v, s[0], s[1]) &&
             !h(s[2], s[3], u, v, s[4], s[5])) ||
            g[u][v]))
        f = true;
    }
  puts(f ? "OTHER" : "CHECKMATE");
  return 0;
}
