#include <bits/stdc++.h>
using namespace std;
pair<int, int> r[2], kw, kb;
char ch;
int a;
int mas[10][10];
int dx[] = {1, 1, 0, -1, -1, -1, 0, 1};
int dy[] = {0, 1, 1, 1, 0, -1, -1, -1};
pair<int, int> get() {
  cin >> ch >> a;
  return make_pair(ch - 'a' + 1, a);
}
int main() {
  r[0] = get();
  r[1] = get();
  kw = get();
  kb = get();
  mas[r[0].first][r[0].second] = mas[r[1].first][r[1].second] =
      mas[kw.first][kw.second] = 2;
  for (int i = 0; i < 2; ++i) {
    for (int j = r[i].first - 1; j >= 0; --j) {
      if (mas[j][r[i].second] == 2) {
        mas[j][r[i].second] = 1;
        break;
      }
      mas[j][r[i].second] = 1;
    }
    for (int j = r[i].first + 1; j <= 8; ++j) {
      if (mas[j][r[i].second] == 2) {
        mas[j][r[i].second] = 1;
        break;
      }
      mas[j][r[i].second] = 1;
    }
    for (int j = r[i].second - 1; j >= 0; --j) {
      if (mas[r[i].first][j] == 2) {
        mas[r[i].first][j] = 1;
        break;
      }
      mas[r[i].first][j] = 1;
    }
    for (int j = r[i].second + 1; j <= 8; ++j) {
      if (mas[r[i].first][j] == 2) {
        mas[r[i].first][j] = 1;
        break;
      }
      mas[r[i].first][j] = 1;
    }
  }
  for (int i = 0; i < 8; ++i) mas[kw.first + dx[i]][kw.second + dy[i]] = 1;
  if (0) {
    cout << "mas"
         << ": " << endl;
    for (int innercounter = 0; innercounter < 9; ++innercounter) {
      for (int innercounter2 = 0; innercounter2 < 9; ++innercounter2)
        cout << mas[innercounter][innercounter2] << " ";
      cout << endl;
    }
  };
  if (mas[kb.first][kb.second] != 1) {
    puts("OTHER");
    return 0;
  }
  for (int i = 0; i < 8; ++i)
    if (kb.first + dx[i] >= 1 && kb.first + dx[i] <= 8 &&
        kb.second + dy[i] >= 1 && kb.second + dy[i] <= 8 &&
        mas[kb.first + dx[i]][kb.second + dy[i]] != 1) {
      if (0) {
        cout << "kb.X + dx[i]"
             << ": " << kb.first + dx[i] << endl;
      };
      if (0) {
        cout << "kb.Y + dy[i]"
             << ": " << kb.second + dy[i] << endl;
      };
      puts("OTHER");
      return 0;
    }
  puts("CHECKMATE");
  return 0;
}
