#include <bits/stdc++.h>
using namespace std;
int a[10][10];
int b[10][10];
void makelad(int x1, int y1) {
  for (int i = x1 - 1; i >= 0; --i) {
    a[i][y1] = 1;
    if (b[i][y1] == 1) break;
  }
  for (int i = x1 + 1; i < 8; ++i) {
    a[i][y1] = 1;
    if (b[i][y1] == 1) break;
  }
  for (int i = y1 - 1; i >= 0; --i) {
    a[x1][i] = 1;
    if (b[x1][i] == 1) break;
  }
  for (int i = y1 + 1; i < 8; ++i) {
    a[x1][i] = 1;
    if (b[x1][i] == 1) break;
  }
}
bool cor(int x, int y) {
  if ((x >= 0) && (y >= 0) && (x < 8) && (y < 8)) return true;
  return false;
}
int main() {
  memset(a, 0, sizeof(a));
  memset(b, 0, sizeof(b));
  int x1, y1, x2, y2, x3, y3, x4, y4;
  string s1, s2, s3, s4;
  cin >> s1 >> s2 >> s3 >> s4;
  x1 = s1[0] - 'a';
  y1 = s1[1] - '1';
  x2 = s2[0] - 'a';
  y2 = s2[1] - '1';
  x3 = s3[0] - 'a';
  y3 = s3[1] - '1';
  x4 = s4[0] - 'a';
  y4 = s4[1] - '1';
  b[x1][y1] = b[x2][y2] = b[x3][y3] = 1;
  bool f = false;
  for (int i = (-1); i < (2); ++i)
    for (int j = (-1); j < (2); ++j) {
      if (cor(x4 + i, y4 + j) && (a[x4 + i][y4 + j] == 0)) {
        memset(a, 0, sizeof(a));
        b[x4 + i][y4 + j] = 1;
        makelad(x1, y1);
        makelad(x2, y2);
        for (int i1 = (-1); i1 < (2); ++i1)
          for (int j1 = (-1); j1 < (2); ++j1) {
            if (((i1 != 0) || (j1 != 0)) && cor(x3 + i1, y3 + j1)) {
              a[x3 + i1][y3 + j1] = 1;
            }
          }
        if (a[x4 + i][y4 + j] == 0) f = true;
        b[x4 + i][y4 + j] = 0;
      }
    }
  if (f)
    printf("OTHER\n");
  else
    printf("CHECKMATE\n");
  return 0;
}
