#include <bits/stdc++.h>
using namespace std;
int A[4], i, j;
bool B[10][10], D[10][10], H;
char C[4];
void rock(int x, int y) {
  for (i = x + 1; !D[i][y]; i++) {
    B[i][y] = 1;
  }
  for (i = x - 1; !D[i][y]; i--) {
    B[i][y] = 1;
  }
  for (i = y + 1; !D[x][i]; i++) {
    B[x][i] = 1;
  }
  for (i = y - 1; !D[x][i]; i--) {
    B[x][i] = 1;
  }
}
void king(int x, int y) {
  H = 1;
  for (i = -1; i <= 1; i++) {
    for (j = -1; j <= 1; j++) {
      if (!B[x + i][y + j]) {
        H = 0;
        B[x + i][y + j] = 1;
      }
    }
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  for (i = 0; i < 10; i++) {
    B[i][0] = B[i][9] = B[0][i] = B[9][i] = 1;
    D[i][0] = D[i][9] = D[0][i] = D[9][i] = 1;
  }
  for (i = 0; i < 4; i++) {
    cin >> C[i] >> A[i];
  }
  D['i' - C[2]][A[2]] = 1;
  rock('i' - C[0], A[0]);
  rock('i' - C[1], A[1]);
  king('i' - C[2], A[2]);
  king('i' - C[3], A[3]);
  if (H) {
    cout << "CHECKMATE\n";
  } else {
    cout << "OTHER\n";
  }
}
