#include <bits/stdc++.h>
using namespace std;
const int MAXN = 8;
bool check[MAXN][MAXN];
int stay[MAXN][MAXN];
int dx[] = {-1, -1, -1, 0, 0, 1, 1, 1};
int dy[] = {-1, 0, 1, -1, 1, -1, 0, 1};
bool Good(int x, int y) { return x >= 0 && x < MAXN && y >= 0 && y < MAXN; }
struct Node {
  int x, y;
  void Read() {
    char c1, c2;
    cin >> c1 >> c2;
    x = (c1 - 'a');
    y = (c2 - '1');
    static int qqq = 3;
    stay[x][y] = qqq--;
  }
  void FillLad() {
    for (int i = x - 1; i >= 0; --i) {
      if (stay[i][y] == 1) break;
      check[i][y] = true;
    }
    for (int i = x + 1; i < MAXN; ++i) {
      if (stay[i][y] == 1) break;
      check[i][y] = true;
    }
    for (int j = y - 1; j >= 0; --j) {
      if (stay[x][j] == 1) break;
      check[x][j] = true;
    }
    for (int j = y + 1; j < MAXN; ++j) {
      if (stay[x][j] == 1) break;
      check[x][j] = true;
    }
  }
  void FillKing() {
    int xx, yy;
    for (int k = 0; k < 8; ++k) {
      xx = x + dx[k];
      yy = y + dy[k];
      if (!Good(xx, yy)) continue;
      check[xx][yy] = true;
    }
  }
  bool GoKing() {
    int xx, yy;
    for (int k = 0; k < 8; ++k) {
      xx = x + dx[k];
      yy = y + dy[k];
      if (!Good(xx, yy)) continue;
      if (!check[xx][yy]) {
        return true;
      }
    }
    return false;
  }
};
Node lad[2];
Node k1, k2;
int main() {
  lad[0].Read();
  lad[1].Read();
  k1.Read();
  k2.Read();
  lad[0].FillLad();
  lad[1].FillLad();
  k1.FillKing();
  if (check[k2.x][k2.y] && !k2.GoKing()) {
    cout << "CHECKMATE" << endl;
  } else {
    cout << "OTHER" << endl;
  }
  return 0;
}
