#include <bits/stdc++.h>
using namespace std;
bool attacked[10][10];
int dx[] = {0, 0, 1, 1, 1, -1, -1, -1};
int dy[] = {1, -1, 0, 1, -1, 0, 1, -1};
int Kx, Ky;
void rook(int x, int y) {
  for (int i = x - 1; i >= 0; i--) {
    attacked[i][y] = 1;
    if (i == Kx && y == Ky) break;
  }
  for (int i = x + 1; i < 8; i++) {
    attacked[i][y] = 1;
    if (i == Kx && y == Ky) break;
  }
  for (int i = y - 1; i >= 0; i--) {
    attacked[x][i] = 1;
    if (x == Kx && i == Ky) break;
  }
  for (int i = y + 1; i < 8; i++) {
    attacked[x][i] = 1;
    if (x == Kx && i == Ky) break;
  }
}
void king(int x, int y) {
  for (int i = 0; i < 8; i++) {
    int xx = x + dx[i];
    int yy = y + dy[i];
    if (xx < 0 || yy < 0) continue;
    attacked[xx][yy] = 1;
  }
}
bool checkmate(int x, int y) {
  if (!attacked[x][y]) return 0;
  for (int i = 0; i < 8; i++) {
    int xx = x + dx[i];
    int yy = y + dy[i];
    if (xx < 0 || yy < 0 || xx == 8 || yy == 8) continue;
    if (!attacked[xx][yy]) return 0;
  }
  return 1;
}
int main() {
  memset(attacked, 0, sizeof attacked);
  vector<pair<int, int> > pos;
  for (int i = 0; i < 4; i++) {
    string s;
    cin >> s;
    int x = s[0] - 'a';
    int y = s[1] - '1';
    pos.push_back(pair<int, int>(x, y));
  }
  Kx = pos[2].first;
  Ky = pos[2].second;
  rook(pos[0].first, pos[0].second);
  rook(pos[1].first, pos[1].second);
  king(pos[2].first, pos[2].second);
  cout << (checkmate(pos[3].first, pos[3].second) ? "CHECKMATE" : "OTHER")
       << endl;
}
