#include <bits/stdc++.h>
using namespace std;
const int maxN = 100;
pair<int, int> read() {
  char x, y;
  cin >> x >> y;
  return pair<int, int>(x - 'a' + 1, y - '0');
}
int f[maxN][maxN];
bool inboard(int x, int y) { return 0 < x && x < 9 && 0 < y && y < 9; }
pair<int, int> fr, sr, wk, bk;
void mark(pair<int, int> fr) {
  for (int i = fr.first + 1; i <= 8; i++)
    if (pair<int, int>(i, fr.second) == wk)
      break;
    else
      f[i][fr.second] = 1;
  for (int i = fr.first - 1; i >= 1; i--)
    if (pair<int, int>(i, fr.second) == wk)
      break;
    else
      f[i][fr.second] = 1;
  for (int i = fr.second + 1; i <= 8; i++)
    if (pair<int, int>(fr.first, i) == wk)
      break;
    else
      f[fr.first][i] = 1;
  for (int i = fr.second - 1; i >= 1; i--)
    if (pair<int, int>(fr.first, i) == wk)
      break;
    else
      f[fr.first][i] = 1;
}
int main() {
  fr = read(), sr = read(), wk = read(), bk = read();
  for (int i = -1; i <= 1; i++)
    for (int j = -1; j <= 1; j++) f[wk.first + i][wk.second + j] = 1;
  mark(fr);
  mark(sr);
  int beat = 1;
  for (int i = -1; i <= 1; i++)
    for (int j = -1; j <= 1; j++)
      if (inboard(bk.first + i, bk.second + j))
        if (!f[bk.first + i][bk.second + j]) beat = 0;
  if (!beat)
    cout << "OTHER" << endl;
  else
    cout << "CHECKMATE" << endl;
  return 0;
}
