#include <bits/stdc++.h>
using namespace std;
class Chess {
  static const int N = 10;
  char mas[N][N];

 public:
  Chess() {
    for (int i = 0; i < N; ++i) {
      for (int j = 0; j < N; ++j) {
        if (!i || !j || i == N - 1 || j == N - 1)
          mas[i][j] = '5';
        else
          mas[i][j] = '0';
      }
    }
  }
  void All() {
    int x, y;
    char cp;
    int lx[2], ly[2];
    cin >> cp >> ly[0];
    lx[0] = cp - 'a' + 1;
    cin >> cp >> ly[1];
    lx[1] = cp - 'a' + 1;
    cin >> cp >> y;
    x = cp - 'a' + 1;
    mas[x][y] = '4';
    int dx[] = {-1, 1, -1, 1, 0, 0, -1, 1};
    int dy[] = {1, -1, -1, 1, 1, -1, 0, 0};
    for (int i = 0; i < 8; ++i) {
      for (int j = 0; j < 8; ++j) {
        mas[x + dx[i]][y + dy[j]] = '3';
      }
    }
    for (int t = 0; t < 2; ++t) {
      x = lx[t];
      y = ly[t];
      if (mas[x][y] == '0') mas[x][y] = '2';
      for (int i = x + 1; mas[i][y] <= '2'; ++i) {
        char tmp = mas[i][y];
        mas[i][y] = '1';
        if (tmp == '2') break;
      }
      for (int i = x - 1; mas[i][y] <= '2'; --i) {
        char tmp = mas[i][y];
        mas[i][y] = '1';
        if (tmp == '2') break;
      }
      for (int i = y + 1; mas[x][i] <= '2'; ++i) {
        char tmp = mas[x][i];
        mas[x][i] = '1';
        if (tmp == '2') break;
      }
      for (int i = y - 1; mas[x][i] <= '2'; --i) {
        char tmp = mas[x][i];
        mas[x][i] = '1';
        if (tmp == '2') break;
      }
    }
    cin >> cp >> y;
    x = cp - 'a' + 1;
    bool fl = mas[x][y] == '0';
    for (int i = 0; !fl && i < 8; ++i) {
      for (int j = 0; !fl && j < 8; ++j) {
        fl = mas[x + dx[i]][y + dy[j]] == '0' ||
             mas[x + dx[i]][y + dy[j]] == '2';
      }
    }
    cout << (fl ? "OTHER" : "CHECKMATE") << endl;
  }
};
int main() {
  Chess A;
  A.All();
  return 0;
}
