#include <bits/stdc++.h>
using namespace std;
int a[8][8];
void putLFire(pair<int, int> WL1) {
  int I = WL1.first;
  int J = WL1.second;
  for (int i = I + 1; i < 8; i++) {
    if (a[i][J] == 2) break;
    a[i][J] = 1;
  }
  I = WL1.first;
  J = WL1.second;
  for (int i = I - 1; i >= 0; i--) {
    if (a[i][J] == 2) break;
    a[i][J] = 1;
  }
  I = WL1.first;
  J = WL1.second;
  for (int j = J - 1; j >= 0; j--) {
    if (a[I][j] == 2) break;
    a[I][j] = 1;
  }
  I = WL1.first;
  J = WL1.second;
  for (int j = J + 1; j < 8; j++) {
    if (a[I][j] == 2) break;
    a[I][j] = 1;
  }
}
void print() {
  for (int i = 0; i < 8; i++) {
    for (int j = 0; j < 8; j++) cout << a[i][j] << " ";
    cout << endl;
  }
}
void putKingFire(pair<int, int> P) {
  for (int i = -1; i < 2; i++)
    for (int j = -1; j < 2; j++)
      if (i != 0 || j != 0) {
        int I = P.first + i;
        int J = P.second + j;
        if (I >= 0 && I < 8 && J >= 0 && J < 8) {
          if (a[I][J] != 2) a[I][J] = 1;
        }
      }
}
int main() {
  string wl1, wl2, wk, bk;
  cin >> wl1;
  cin >> wl2;
  cin >> wk;
  cin >> bk;
  memset(a, 0, sizeof(a));
  pair<int, int> WL1, WL2, WK, BK;
  WL1.first = wl1[0] - 'a';
  WL1.second = wl1[1] - '1';
  WL2.first = wl2[0] - 'a';
  WL2.second = wl2[1] - '1';
  WK.first = wk[0] - 'a';
  WK.second = wk[1] - '1';
  BK.first = bk[0] - 'a';
  BK.second = bk[1] - '1';
  a[WL1.first][WL1.second] = 2;
  a[WL2.first][WL2.second] = 2;
  a[WK.first][WK.second] = 2;
  putLFire(WL1);
  putLFire(WL2);
  if (a[BK.first][BK.second] == 1) {
    bool survive = false;
    for (int i = -1; i < 2; i++)
      for (int j = -1; j < 2; j++)
        if (i != 0 || j != 0) {
          int I = BK.first + i;
          int J = BK.second + j;
          if (I >= 0 && I < 8 && J >= 0 && J < 8) {
            bool w1 = true;
            bool w2 = true;
            if (I == WL1.first && J == WL1.second) w1 = false;
            if (I == WL2.first && J == WL2.second) w2 = false;
            memset(a, 0, sizeof(a));
            if (w1) a[WL1.first][WL1.second] = 2;
            if (w2) a[WL2.first][WL2.second] = 2;
            a[WK.first][WK.second] = 2;
            if (w1) putLFire(WL1);
            if (w2) putLFire(WL2);
            putKingFire(WK);
            if (a[I][J] == 0) survive = true;
          }
        }
    if (survive)
      cout << "OTHER" << endl;
    else
      cout << "CHECKMATE" << endl;
  } else {
    cout << "OTHER" << endl;
  }
  return 0;
}
