#include <bits/stdc++.h>
using namespace std;
const int N = 107;
const long long mod = 1e9 + 7;
const int rx[8] = {1, -1, 0, 0, 1, 1, -1, -1};
const int ry[8] = {0, 0, 1, -1, 1, -1, 1, -1};
const long double pi = acos(-1.0);
const int B = (int)sqrt(N);
int d[16 / 2][2 * 4];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  string lada1, lada2, korol, black;
  cin >> lada1 >> lada2 >> korol >> black;
  int l1x = lada1[0] - 'a', l1y = lada1[1] - '1';
  int l2x = lada2[0] - 'a', l2y = lada2[1] - '1';
  int kx = korol[0] - 'a', ky = korol[1] - '1';
  int bx = black[0] - 'a', by = black[1] - '1';
  d[kx][ky] = 2;
  for (int i = 0; i < 4; ++i) {
    int x = l1x + rx[i], y = l1y + ry[i];
    while (x > -1 && y > -1 && x < 16 / 2 && y < 2 * 4 && d[x][y] != 2) {
      d[x][y] = 1;
      x += rx[i], y += ry[i];
    }
  }
  for (int i = 0; i < 4; ++i) {
    int x = l2x + rx[i], y = l2y + ry[i];
    while (x > -1 && y > -1 && x < 16 / 2 && y < 2 * 4 && d[x][y] != 2) {
      d[x][y] = 1;
      x += rx[i], y += ry[i];
    }
  }
  for (int i = max(0, kx - 1); i < min(8, kx + 2); ++i)
    for (int j = max(0, ky - 1); j < min(8, ky + 2); ++j) d[i][j] = 1;
  for (int i = max(0, bx - 1); i < min(8, bx + 2); ++i)
    for (int j = max(0, by - 1); j < min(8, by + 2); ++j)
      if (!d[i][j]) {
        cout << "OTHER" << '\n';
        return 0;
      }
  cout << "CHECKMATE" << '\n';
  return 0;
}
