#include <bits/stdc++.h>
using namespace std;
const int INF = 2147483647;
const long long LLINF = 9223372036854775807;
char a[10][5];
int brd[10][10] = {0};
void lad(int x, int y) {
  int d[4][2] = {{0, 1}, {0, -1}, {1, 0}, {-1, 0}};
  for (int i = 0; i < 4; ++i) {
    int cx = x, cy = y;
    while (1) {
      cx += d[i][0];
      cy += d[i][1];
      if (cx < 0 || cy < 0 || cx >= 8 || cy >= 8 ||
          cx == a[2][0] && cy == a[2][1])
        break;
      brd[cx][cy] = 1;
    }
  }
}
int main() {
  for (int i = 0; i < 4; ++i)
    for (int j = 0; j < 2; ++j) {
      cin >> a[i][j];
      if (j % 2 == 0)
        a[i][j] -= 'a';
      else
        a[i][j] -= '1';
    }
  lad(a[0][0], a[0][1]);
  lad(a[1][0], a[1][1]);
  for (int i = -1; i <= 1; ++i)
    for (int j = -1; j <= 1; ++j) {
      int ci = a[2][0] + i, cj = a[2][1] + j;
      if (ci < 0 || cj < 0 || ci >= 8 || cj >= 8) continue;
      brd[ci][cj] = 1;
    }
  for (int i = -1; i <= 1; ++i)
    for (int j = -1; j <= 1; ++j) {
      int ci = a[3][0] + i, cj = a[3][1] + j;
      if (ci < 0 || cj < 0 || ci >= 8 || cj >= 8) continue;
      if (brd[ci][cj] == 0) cout << "OTHER", exit(0);
    }
  cout << "CHECKMATE";
  return 0;
}
