#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9 + 7;
int dx[] = {1, -1, 0, 0, 1, -1, 1, -1};
int dy[] = {0, 0, 1, -1, 1, -1, -1, 1};
int r1x, r1y;
int r2x, r2y;
int wx, wy;
const bool DEBUG = false;
bool check(int bx, int by) {
  if (bx < 0 || bx >= 8 || by < 0 || by >= 8) return true;
  if (bx == wx && by == wy) {
    wx = -wx - 10;
    wy = -wy - 10;
  }
  if (bx == r1x && by == r1y) {
    r1x = -r1x - 10;
    r1y = -r1y - 10;
  }
  if (bx == r2x && by == r2y) {
    r2x = -r2x - 10;
    r2y = -r2y - 10;
  }
  if (wx >= 0) {
    for (int k = 0; k < 8; k++) {
      int cx = wx + dx[k], cy = wy + dy[k];
      if (cx == bx && cy == by) {
        return true;
      }
    }
  }
  bool board[10][10] = {};
  if (r1x >= 0) {
    for (int x = r1x; x < 8; x++) {
      if (x == wx && r1y == wy) break;
      board[x][r1y] = true;
    }
    for (int x = r1x; x >= 0; x--) {
      if (x == wx && r1y == wy) break;
      board[x][r1y] = true;
    }
    for (int y = r1y; y < 8; y++) {
      if (r1x == wx && y == wy) break;
      board[r1x][y] = true;
    }
    for (int y = r1y; y >= 0; y--) {
      if (r1x == wx && y == wy) break;
      board[r1x][y] = true;
    }
  }
  if (r2x >= 0) {
    for (int x = r2x; x < 8; x++) {
      if (x == wx && r2y == wy) break;
      board[x][r2y] = true;
    }
    for (int x = r2x; x >= 0; x--) {
      if (x == wx && r2y == wy) break;
      board[x][r2y] = true;
    }
    for (int y = r2y; y < 8; y++) {
      if (r2x == wx && y == wy) break;
      board[r2x][y] = true;
    }
    for (int y = r2y; y >= 0; y--) {
      if (r2x == wx && y == wy) break;
      board[r2x][y] = true;
    }
  }
  if (DEBUG) {
    for (int i = 0; i < 8; i++) {
      for (int j = 0; j < 8; j++) {
        if (i == r1y && j == r1x)
          cout << '1';
        else if (i == r2y && j == r2x)
          cout << '2';
        else if (i == wy && j == wx)
          cout << 'w';
        else if (i == by && j == bx)
          cout << 'b';
        else
          cout << (board[j][i] ? '.' : ' ');
      }
      cout << endl;
    }
    cout << endl;
  }
  if (wx < 0) {
    wx = -wx - 10;
    wy = -wy - 10;
  }
  if (r1x < 0) {
    r1x = -r1x - 10;
    r1y = -r1y - 10;
  }
  if (r2x < 0) {
    r2x = -r2x - 10;
    r2y = -r2y - 10;
  }
  return board[bx][by];
}
int main() {
  int bx, by;
  string str;
  cin >> str;
  r1x = str[0] - 'a';
  r1y = str[1] - '1';
  cin >> str;
  r2x = str[0] - 'a';
  r2y = str[1] - '1';
  cin >> str;
  wx = str[0] - 'a';
  wy = str[1] - '1';
  cin >> str;
  bx = str[0] - 'a';
  by = str[1] - '1';
  if (DEBUG) {
    cout << "r1x=" << r1x << endl;
    cout << "r1y=" << r1y << endl;
    cout << "r2x=" << r2x << endl;
    cout << "r2y=" << r2y << endl;
    cout << "wx=" << wx << endl;
    cout << "wy=" << wy << endl;
    cout << "bx=" << bx << endl;
    cout << "by=" << by << endl;
  }
  if (!check(bx, by)) {
    cout << "OTHER" << endl;
    return 0;
  }
  for (int k = 0; k < 8; k++) {
    if (!check(bx + dx[k], by + dy[k])) {
      cout << "OTHER" << endl;
      return 0;
    }
  }
  cout << "CHECKMATE" << endl;
  return 0;
}
