#include <bits/stdc++.h>
using namespace std;
int fk[] = {1, -1, 0, 0, 1, 1, -1, -1};
int lk[] = {0, 0, 1, -1, 1, -1, 1, -1};
string l1, l2, wk, bk;
int al1, bl1, al2, bl2, awk, bwk, abk, bbk, i, j, vr1, vr2, vr3, vr4, u[10][10],
    q[10][10];
int main() {
  cin >> l1 >> l2 >> wk >> bk;
  al1 = (l1[0] - 'a' + 1);
  bl1 = (l1[1] - '0');
  al2 = (l2[0] - 'a' + 1);
  bl2 = (l2[1] - '0');
  awk = (wk[0] - 'a' + 1);
  bwk = (wk[1] - '0');
  abk = (bk[0] - 'a' + 1);
  bbk = (bk[1] - '0');
  q[bl1][al1] = 1;
  q[bl2][al2] = 1;
  q[bwk][awk] = 1;
  for (i = al1 - 1; i >= 1; i--) {
    u[bl1][i]++;
    if (q[bl1][i] == 1) break;
  }
  for (i = al1 + 1; i < 9; i++) {
    u[bl1][i]++;
    if (q[bl1][i] == 1) break;
  }
  for (i = bl1 - 1; i >= 1; i--) {
    u[i][al1]++;
    if (q[i][al1] == 1) break;
  }
  for (i = bl1 + 1; i < 9; i++) {
    u[i][al1]++;
    if (q[i][al1] == 1) break;
  }
  for (i = al2 - 1; i >= 1; i--) {
    u[bl2][i]++;
    if (q[bl2][i] == 1) break;
  }
  for (i = al2 + 1; i < 9; i++) {
    u[bl2][i]++;
    if (q[bl2][i] == 1) break;
  }
  for (i = bl2 - 1; i >= 1; i--) {
    u[i][al2]++;
    if (q[i][al2] == 1) break;
  }
  for (i = bl2 + 1; i < 9; i++) {
    u[i][al2]++;
    if (q[i][al2] == 1) break;
  }
  for (i = 0; i < 8; i++) {
    if ((awk + fk[i]) > 0 && (bwk + lk[i]) > 0 && (awk + fk[i]) < 9 &&
        (bwk + lk[i]) < 9)
      u[bwk + lk[i]][awk + fk[i]]++;
  }
  if (u[bbk][abk] == 0) {
    cout << "OTHER";
    return 0;
  }
  for (i = 0; i < 8; i++) {
    if ((abk + fk[i]) > 0 && (bbk + lk[i]) > 0 && (abk + fk[i]) < 9 &&
        (bbk + lk[i]) < 9) {
      if (u[bbk + lk[i]][abk + fk[i]] > 0) vr1++;
      if (u[bbk + lk[i]][abk + fk[i]] == 0) vr3 = 1;
      if (q[bbk + lk[i]][abk + fk[i]] == 1 && u[bbk + lk[i]][abk + fk[i]] == 0)
        vr2 = 1;
      vr4++;
    }
  }
  if (vr3 == 1) {
    cout << "OTHER";
    return 0;
  }
  if (vr2 == 1) {
    cout << "OTHER";
    return 0;
  }
  if (vr1 == vr4)
    cout << "CHECKMATE";
  else
    cout << "OTHER";
  return 0;
}
