#include <bits/stdc++.h>
using namespace std;
string s;
int p1, p2, q1, q2, r1, r2, s1, s2, a[10][10], i, j, x, y;
bool z;
int main() {
  getline(cin, s);
  p1 = s[0] - 'a' + 1;
  q1 = s[1] - '0';
  p2 = s[3] - 'a' + 1;
  q2 = s[4] - '0';
  r1 = s[6] - 'a' + 1;
  s1 = s[7] - '0';
  r2 = s[9] - 'a' + 1;
  s2 = s[10] - '0';
  memset(a, -1, sizeof(a));
  x = p1;
  y = q1;
  for (;;) {
    x--;
    a[x][y] = 1;
    if (x == r1 && y == s1) break;
    if (x <= 0) break;
  }
  x = p1;
  y = q1;
  for (;;) {
    x++;
    a[x][y] = 1;
    if (x == r1 && y == s1) break;
    if (x > 8) break;
  }
  x = p1;
  y = q1;
  for (;;) {
    y--;
    a[x][y] = 1;
    if (x == r1 && y == s1) break;
    if (y <= 0) break;
  }
  x = p1;
  y = q1;
  for (;;) {
    y++;
    a[x][y] = 1;
    if (x == r1 && y == s1) break;
    if (y > 8) break;
  }
  x = p2;
  y = q2;
  for (;;) {
    x--;
    a[x][y] = 1;
    if (x == r1 && y == s1) break;
    if (x <= 0) break;
  }
  x = p2;
  y = q2;
  for (;;) {
    x++;
    a[x][y] = 1;
    if (x == r1 && y == s1) break;
    if (x > 8) break;
  }
  x = p2;
  y = q2;
  for (;;) {
    y--;
    a[x][y] = 1;
    if (x == r1 && y == s1) break;
    if (y <= 0) break;
  }
  x = p2;
  y = q2;
  for (;;) {
    y++;
    a[x][y] = 1;
    if (x == r1 && y == s1) break;
    if (y > 8) break;
  }
  for (i = 1; i <= 8; i++)
    for (j = 1; j <= 8; j++)
      if (i <= r1 + 1 && i >= r1 - 1 && j <= s1 + 1 && j >= s1 - 1) a[i][j] = 1;
  z = true;
  if (a[r2][s2] == -1) z = false;
  for (i = r2 - 1; i <= r2 + 1; i++)
    for (j = s2 - 1; j <= s2 + 1; j++)
      if (i >= 1 && i <= 8 && j >= 1 && j <= 8)
        if (a[i][j] == -1) z = false;
  if (z == true)
    cout << "CHECKMATE" << endl;
  else
    cout << "OTHER" << endl;
}
