#include <bits/stdc++.h>
using namespace std;
string w, b, t1, t2;
long long a[12][12];
void make(string t1) {
  int row = t1[0] - 'a' + 1;
  int col = t1[1] - '0';
  for (int i = row + 1; i <= 8; i++) {
    if (a[i][col] == -1) break;
    a[i][col] = 1;
  }
  for (int i = row - 1; i > 0; i--) {
    if (a[i][col] == -1) break;
    a[i][col] = 1;
  }
  for (int i = col + 1; i <= 8; i++) {
    if (a[row][i] == -1) break;
    a[row][i] = 1;
  }
  for (int i = col - 1; i > 0; i--) {
    if (a[row][i] == -1) break;
    a[row][i] = 1;
  }
}
int main() {
  ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
  for (int i = 0; i <= 11; i++) {
    for (int j = 0; j <= 11; j++) a[i][j] = 1;
  }
  for (int i = 1; i <= 8; i++)
    for (int j = 1; j <= 8; j++) a[i][j] = 0;
  cin >> t1 >> t2 >> w >> b;
  int row1 = w[0] - 'a' + 1;
  int col1 = w[1] - '0';
  a[row1][col1] = -1;
  a[row1 + 1][col1] = 1;
  a[row1 - 1][col1] = 1;
  a[row1][col1 + 1] = 1;
  a[row1][col1 - 1] = 1;
  a[row1 + 1][col1 + 1] = 1;
  a[row1 + 1][col1 - 1] = 1;
  a[row1 - 1][col1 + 1] = 1;
  a[row1 - 1][col1 - 1] = 1;
  make(t1);
  make(t2);
  int row = b[0] - 'a' + 1;
  int col = b[1] - '0';
  if (a[row][col] == 0 || a[row - 1][col] == 0 || a[row + 1][col] == 0 ||
      a[row][col - 1] == 0 || a[row][col + 1] == 0 ||
      a[row - 1][col + 1] == 0 || a[row - 1][col - 1] == 0 ||
      a[row + 1][col - 1] == 0 || a[row + 1][col + 1] == 0)
    cout << "OTHER\n";
  else
    cout << "CHECKMATE\n";
  return 0;
}
