#include <bits/stdc++.h>
using namespace std;
int a[8][8];
void read(int type) {
  char t[8];
  scanf("%s", t);
  int x = t[0] - 'a', y = t[1] - '1';
  a[x][y] = type;
}
int dx[] = {1, 0, -1, 0, 1, -1, 1, -1};
int dy[] = {0, 1, 0, -1, 1, 1, -1, -1};
bool b[8][8];
void go(int i, int j, int dx, int dy) {
  for (;;) {
    i += dx;
    j += dy;
    if (i < 0 || i > 7 || j < 0 || j > 7) return;
    b[i][j] = true;
    if (a[i][j]) return;
  }
}
void mate() {
  puts("CHECKMATE");
  exit(0);
}
void other() {
  puts("OTHER");
  exit(0);
}
bool beated() {
  memset(b, 0, sizeof b);
  for (int i(0); i < 8; ++i)
    for (int j(0); j < 8; ++j) {
      if (a[i][j] == 5) {
        for (int k(0); k < 4; ++k) go(i, j, dx[k], dy[k]);
      } else if (a[i][j] == 1) {
        for (int k(0); k < 8; ++k) {
          int x = i + dx[k], y = j + dy[k];
          if (x >= 0 && x < 8 && y >= 0 && y < 8) b[x][y] = true;
        }
      }
    }
  for (int i(0); i < 8; ++i)
    for (int j(0); j < 8; ++j)
      if (a[i][j] < 0) return b[i][j];
  return false;
}
int main() {
  read(5);
  read(5);
  read(1);
  read(-1);
  if (beated()) {
    for (int i(0); i < 8; ++i)
      for (int j(0); j < 8; ++j)
        if (a[i][j] < 0) {
          for (int k(0); k < 8; ++k) {
            int x = i + dx[k], y = j + dy[k];
            if (x >= 0 && x < 8 && y >= 0 && y < 8) {
              int q = a[x][y];
              a[x][y] = a[i][j];
              a[i][j] = 0;
              if (!beated()) other();
              a[i][j] = a[x][y];
              a[x][y] = q;
            }
          }
          mate();
        }
  }
  other();
}
