#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;
int bx, by;
int a[10][10];
int main() {
  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';
  for (int k = 0; k < 4; k++) {
    int x = r1x, y = r1y;
    while (x >= 0 && x < 8 && y >= 0 && y < 8 && (x != wx || y != wy)) {
      a[x][y]++;
      x += dx[k];
      y += dy[k];
    }
    a[r1x][r1y]--;
  }
  for (int k = 0; k < 4; k++) {
    int x = r2x, y = r2y;
    while (x >= 0 && x < 8 && y >= 0 && y < 8 && (x != wx || y != wy)) {
      a[x][y]++;
      x += dx[k];
      y += dy[k];
    }
    a[r2x][r2y]--;
  }
  for (int k = 0; k < 8; k++) {
    if (wx + dx[k] < 0 || wx + dx[k] >= 8 || wy + dy[k] < 0 || wy + dy[k] >= 8)
      continue;
    a[wx + dx[k]][wy + dy[k]]++;
  }
  if (!a[bx][by]) {
    cout << "OTHER" << endl;
    return 0;
  }
  for (int k = 0; k < 8; k++) {
    if (bx + dx[k] < 0 || bx + dx[k] >= 8 || by + dy[k] < 0 || by + dy[k] >= 8)
      continue;
    if (!a[bx + dx[k]][by + dy[k]]) {
      cout << "OTHER" << endl;
      return 0;
    }
  }
  cout << "CHECKMATE" << endl;
  return 0;
}
