#include <bits/stdc++.h>
using namespace std;
long long max(long long a, long long b) { return a > b ? a : b; }
const int NN = 55;
const long long MaxVal = 2222222222LL;
bool check(int x, int y, vector<string> &pos) {
  if (x == 1 && y == 0) int h = 423;
  for (int i = 0; i < 2; i++) {
    int rx = pos[i][0] - 'a', ry = pos[i][1] - '1';
    if (rx == x && ry == y) continue;
    if (rx == x) {
      bool f = true;
      for (int j = min(ry, y) + 1; j < max(ry, y); j++) {
        string aux = string(1, pos[i][0]) + string(1, char(j + '1'));
        for (int k = 0; k < 3; k++)
          if (k != i && aux == pos[k]) f = false;
      }
      if (f) return false;
    }
    if (ry == y) {
      bool f = true;
      for (int j = min(rx, x) + 1; j < max(rx, x); j++) {
        string aux = string(1, char(j + 'a')) + string(1, pos[i][1]);
        for (int k = 0; k < 3; k++)
          if (k != i && aux == pos[k]) f = false;
      }
      if (f) return false;
    }
  }
  for (int i = -1; i < 1 + 1; i++)
    for (int j = -1; j < 1 + 1; j++) {
      int kx = pos[2][0] - 'a' + i, ky = pos[2][1] - '1' + j;
      if (kx >= 0 && kx < 8 && ky >= 0 && ky < 8) {
        string aux = string(1, char(kx + 'a')) + string(1, char(ky + '1'));
        if (kx == x && ky == y) return false;
      }
    }
  return true;
}
int main() {
  vector<string> pos(4);
  for (int i = 0; i < 4; i++) cin >> pos[i];
  bool f = false;
  for (int i = -1; i < 1 + 1; i++)
    for (int j = -1; j < 1 + 1; j++) {
      int x = pos[3][0] - 'a' + i, y = pos[3][1] - '1' + j;
      if (x >= 0 && x < 8 && y >= 0 && y < 8) {
        if (check(x, y, pos)) {
          f = true;
        }
      }
    }
  if (!f)
    printf("CHECKMATE\n");
  else
    printf("OTHER\n");
  return 0;
}
