#include <bits/stdc++.h>
using namespace std;
char b[10][10];
bool d[10][10];
int dx[8] = {-1, 0, 1, 0, -1, -1, 1, 1};
int dy[8] = {0, -1, 0, 1, -1, 1, 1, -1};
bool ok(int i, int j) { return 0 <= i && i < 8 && 0 <= j && j < 8; }
int main() {
  char s[5];
  cin >> s;
  b[s[0] - 'a'][s[1] - '1'] = 'R';
  cin >> s;
  b[s[0] - 'a'][s[1] - '1'] = 'R';
  cin >> s;
  b[s[0] - 'a'][s[1] - '1'] = 'K';
  cin >> s;
  int r = s[0] - 'a';
  int c = s[1] - '1';
  for (int i = 0; i < 8; i++)
    for (int j = 0; j < 8; j++)
      if (b[i][j] == 'R') {
        for (int k = i + 1; k < 8 && b[k][j] != 'K'; k++) d[k][j] = 1;
        for (int k = i - 1; k >= 0 && b[k][j] != 'K'; k--) d[k][j] = 1;
        for (int k = j + 1; k < 8 && b[i][k] != 'K'; k++) d[i][k] = 1;
        for (int k = j - 1; k >= 0 && b[i][k] != 'K'; k--) d[i][k] = 1;
      } else if (b[i][j] == 'K') {
        for (int dir = 0; dir < 8; dir++)
          if (ok(i + dx[dir], j + dy[dir])) d[i + dx[dir]][j + dy[dir]] = 1;
      }
  bool checkmate = d[r][c] == 1;
  for (int dir = 0; dir < 8; dir++)
    if (ok(r + dx[dir], c + dy[dir])) {
      if (!d[r + dx[dir]][c + dy[dir]]) checkmate = 0;
    }
  if (checkmate)
    cout << "CHECKMATE" << endl;
  else
    cout << "OTHER" << endl;
  return 0;
}
