#include <bits/stdc++.h>
using namespace std;
int tx[15] = {0, 0, 1, -1, 0, 0, 1, 1, -1, -1};
int ty[15] = {0, 0, 0, 0, 1, -1, 1, -1, 1, -1};
bool flag;
bool safe(int x, int y) { return x >= 1 && x <= 8 && y >= 1 && y <= 8; }
bool checkx(int ax, int ay, int bx, int by, int cx, int cy) {
  if (ax == bx && bx == cx && cy >= min(ay, by) && cy <= max(ay, by))
    return 0;
  else
    return 1;
}
bool checky(int ax, int ay, int bx, int by, int cx, int cy) {
  if (ay == by && by == cy && cx >= min(ax, bx) && cx <= max(ax, bx))
    return 0;
  else
    return 1;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  string a, b, c, d;
  int ax, ay, bx, by, cx, cy, dx, dy;
  cin >> a >> b >> c >> d;
  ax = a[0] - 'a' + 1;
  ay = a[1] - '0';
  bx = b[0] - 'a' + 1;
  by = b[1] - '0';
  cx = c[0] - 'a' + 1;
  cy = c[1] - '0';
  dx = d[0] - 'a' + 1;
  dy = d[1] - '0';
  for (int i = 1; i <= 9; ++i) {
    int nx = dx + tx[i], ny = dy + ty[i];
    if (!safe(nx, ny)) continue;
    if (nx == cx && ny == cy) flag = 1;
    bool flag1 = 1, flag2 = 1, flag3 = 1;
    if (nx == ax && ny == ay) flag1 = 0;
    if (nx == bx && ny == by) flag2 = 0;
    if (flag1 && ((nx == ax && checkx(nx, ny, ax, ay, cx, cy)) ||
                  (ny == ay && checky(nx, ny, ax, ay, cx, cy))))
      flag3 = 0;
    if (flag2 && ((nx == bx && checkx(nx, ny, bx, by, cx, cy)) ||
                  (ny == by && checky(nx, ny, bx, by, cx, cy))))
      flag3 = 0;
    if (flag == 0) {
      for (int j = 1; j <= 9; ++j) {
        int nxx = cx + tx[j], nyy = cy + ty[j];
        if (!safe(nxx, nyy)) continue;
        if (nxx == nx && nyy == ny) {
          flag3 = 0;
          break;
        }
      }
    }
    if (flag3 == 1) {
      flag = 1;
      break;
    }
  }
  if (flag)
    cout << "OTHER" << endl;
  else
    cout << "CHECKMATE" << endl;
  return 0;
}
