#include <bits/stdc++.h>
using namespace std;
bool mark[8][8];
int a[4][2], neigh[8][2] = {{0, 1}, {0, -1}, {1, 0},  {-1, 0},
                            {1, 1}, {-1, 1}, {1, -1}, {-1, -1}};
char b[4][2];
int main() {
  for (int i = 0; i < 4; i++) {
    cin >> b[i][0] >> b[i][1];
    a[i][0] = b[i][0] - 'a';
    a[i][1] = b[i][1] - '1';
  }
  for (int i = 0; i < 2; i++) {
    if (a[2][1] == a[i][1]) {
      if (a[2][0] < a[i][0]) {
        for (int j = a[2][0]; j < 8; j++)
          if (j != a[i][0]) mark[j][a[i][1]] = true;
      } else {
        for (int j = 0; j <= a[2][0]; j++)
          if (j != a[i][0]) mark[j][a[i][1]] = true;
      }
    }
    if (a[2][0] == a[i][0]) {
      if (a[2][1] < a[i][1]) {
        for (int j = a[2][1]; j < 8; j++)
          if (j != a[i][1]) mark[a[i][0]][j] = true;
      } else {
        for (int j = 0; j <= a[2][1]; j++)
          if (j != a[i][1]) mark[a[i][0]][j] = true;
      }
    }
    for (int j = 0; j < 8; j++) {
      if (a[2][1] != a[i][1] && j != a[i][0]) mark[j][a[i][1]] = true;
      if (a[2][0] != a[i][0] && j != a[i][1]) mark[a[i][0]][j] = true;
    }
  }
  for (int i = 0; i < 8; i++) {
    int x = a[2][0] + neigh[i][0], y = a[2][1] + neigh[i][1];
    bool checkBound = 0 <= x && x < 8 && 0 <= y && y < 8;
    if (checkBound) mark[x][y] = true;
  }
  if (!mark[a[3][0]][a[3][1]]) {
    cout << "OTHER\n";
    return 0;
  }
  for (int i = 0; i < 8; i++) {
    int x = a[3][0] + neigh[i][0], y = a[3][1] + neigh[i][1];
    bool checkBound = 0 <= x && x < 8 && 0 <= y && y < 8;
    if (checkBound && !mark[x][y]) {
      cout << "OTHER\n";
      return 0;
    }
  }
  cout << "CHECKMATE\n";
  return 0;
}
