#include <bits/stdc++.h>
using namespace std;
int mas[12][12];
int fl = 0;
int main() {
  fill(&mas[0][0], &mas[0][0] + 12 * 12, -1);
  for (int i = 1; i <= 8; i++)
    for (int j = 1; j <= 8; j++) {
      mas[i][j] = 0;
    }
  string s1, s2, s3, s4;
  cin >> s1 >> s2 >> s3 >> s4;
  int x = int(s4[0] - 'a' + 1);
  int y = int(s4[1] - '0');
  mas[x][y] = 10;
  x = int(s3[0] - 'a' + 1);
  y = int(s3[1] - '0');
  mas[x][y] = 9;
  mas[x - 1][y] = 8;
  mas[x + 1][y] = 8;
  mas[x][y + 1] = 8;
  mas[x][y - 1] = 8;
  mas[x - 1][y - 1] = 8;
  mas[x - 1][y + 1] = 8;
  mas[x + 1][y - 1] = 8;
  mas[x + 1][y + 1] = 8;
  x = int(s2[0] - 'a' + 1);
  y = int(s2[1] - '0');
  for (int i = x + 1; i <= 8; i++) {
    if (mas[i][y] == 10) {
      fl = 1;
    } else {
      if (mas[i][y] == 9)
        break;
      else
        mas[i][y] = 1;
    }
  }
  for (int i = x - 1; i > 0; i--) {
    if (mas[i][y] == 10) {
      fl = 1;
    } else {
      if (mas[i][y] == 9)
        break;
      else
        mas[i][y] = 1;
    }
  }
  for (int i = y + 1; i <= 8; i++) {
    if (mas[x][i] == 10) {
      fl = 1;
    } else {
      if (mas[x][i] == 9)
        break;
      else
        mas[x][i] = 1;
    }
  }
  for (int i = y - 1; i > 0; i--) {
    if (mas[x][i] == 10) {
      fl = 1;
    } else {
      if (mas[x][i] == 9)
        break;
      else
        mas[x][i] = 1;
    }
  }
  x = int(s1[0] - 'a' + 1);
  y = int(s1[1] - '0');
  for (int i = x + 1; i <= 8; i++) {
    if (mas[i][y] == 10) {
      fl = 1;
    } else {
      if (mas[i][y] == 9)
        break;
      else
        mas[i][y] = 1;
    }
  }
  for (int i = x - 1; i > 0; i--) {
    if (mas[i][y] == 10) {
      fl = 1;
    } else {
      if (mas[i][y] == 9)
        break;
      else
        mas[i][y] = 1;
    }
  }
  for (int i = y + 1; i <= 8; i++) {
    if (mas[x][i] == 10) {
      fl = 1;
    } else {
      if (mas[x][i] == 9)
        break;
      else
        mas[x][i] = 1;
    }
  }
  for (int i = y - 1; i > 0; i--) {
    if (mas[x][i] == 10) {
      fl = 1;
    } else {
      if (mas[x][i] == 9)
        break;
      else
        mas[x][i] = 1;
    }
  }
  x = int(s3[0] - 'a' + 1);
  y = int(s3[1] - '0');
  mas[x][y] = 9;
  mas[x - 1][y] = 8;
  mas[x + 1][y] = 8;
  mas[x][y + 1] = 8;
  mas[x][y - 1] = 8;
  mas[x - 1][y - 1] = 8;
  mas[x - 1][y + 1] = 8;
  mas[x + 1][y - 1] = 8;
  mas[x + 1][y + 1] = 8;
  if (fl == 0) {
    cout << "OTHER";
    return 0;
  }
  x = int(s4[0] - 'a' + 1);
  y = int(s4[1] - '0');
  if (mas[x + 1][y] == 0 || mas[x - 1][y] == 0 || mas[x][y + 1] == 0 ||
      mas[x][y - 1] == 0 || mas[x + 1][y + 1] == 0 || mas[x - 1][y + 1] == 0 ||
      mas[x + 1][y - 1] == 0 || mas[x - 1][y - 1] == 0) {
    cout << "OTHER";
    return 0;
  }
  cout << "CHECKMATE";
  return 0;
}
