#include <bits/stdc++.h>
using namespace std;
struct figure {
  int x, y;
  void read() {
    string a;
    cin >> a;
    y = int(a[1] - '0');
    x = int(a[0] - 'a') + 1;
  }
};
bool eq(figure a, figure b) { return (a.x == b.x && a.y == b.y); }
bool correct(figure a) { return (a.x < 9 && a.x > 0 && a.y < 9 && a.y > 0); }
bool board[9][9];
figure r1, r2, k1, k2;
void mark(figure c, figure d, int dx, int dy) {
  while (correct(c) && !eq(c, d) && !eq(c, k1)) {
    c.x += dx;
    c.y += dy;
    if (correct(c)) board[c.x][c.y] = true;
  }
}
inline void close() {
  cout << "OTHER";
  exit(0);
}
int main() {
  r1.read();
  r2.read();
  k1.read();
  k2.read();
  mark(r1, r2, 1, 0);
  mark(r1, r2, -1, 0);
  mark(r1, r2, 0, 1);
  mark(r1, r2, 0, -1);
  mark(r2, r1, 1, 0);
  mark(r2, r1, -1, 0);
  mark(r2, r1, 0, 1);
  mark(r2, r1, 0, -1);
  figure c = k1;
  c.x++;
  if (correct(c)) board[c.x][c.y] = true;
  c.y++;
  if (correct(c)) board[c.x][c.y] = true;
  c.x--;
  if (correct(c)) board[c.x][c.y] = true;
  c.x--;
  if (correct(c)) board[c.x][c.y] = true;
  c.y--;
  if (correct(c)) board[c.x][c.y] = true;
  c.y--;
  if (correct(c)) board[c.x][c.y] = true;
  c.x++;
  if (correct(c)) board[c.x][c.y] = true;
  c.x++;
  if (correct(c)) board[c.x][c.y] = true;
  if (!board[k2.x][k2.y]) close();
  k2.x++;
  if (correct(k2))
    if (!board[k2.x][k2.y]) close();
  k2.y++;
  if (correct(k2))
    if (!board[k2.x][k2.y]) close();
  k2.x--;
  if (correct(k2))
    if (!board[k2.x][k2.y]) close();
  k2.x--;
  if (correct(k2))
    if (!board[k2.x][k2.y]) close();
  k2.y--;
  if (correct(k2))
    if (!board[k2.x][k2.y]) close();
  k2.y--;
  if (correct(k2))
    if (!board[k2.x][k2.y]) close();
  k2.x++;
  if (correct(k2))
    if (!board[k2.x][k2.y]) close();
  k2.x++;
  if (correct(k2))
    if (!board[k2.x][k2.y]) close();
  cout << "CHECKMATE";
  return 0;
}
