#include <bits/stdc++.h>
using namespace std;
long long j, k, a, b, s, l, m, n, t, d;
long long e, i, c[11][11];
string p, q, r, v;
map<long long, long long> y;
int main() {
  cin >> p >> q >> r >> v;
  a = p[0] - 97;
  b = p[1] - 49;
  c[p[0] - 97][p[1] - 49] = 111;
  c[q[0] - 97][q[1] - 49] = 222;
  c[r[0] - 97][r[1] - 49] = 333;
  c[v[0] - 97][v[1] - 49] = 444;
  for (i = 0; i < 8; i++) {
    for (j = 0; j < 8; j++) {
      if (i == a || b == j) {
        l = 0;
        if (b == j) {
          n = min(a, i);
          m = max(a, i);
          for (k = n + 1; k < m; k++)
            if (c[k][j] > 100 && c[k][j] < 444) l = 1;
        }
        if (a == i) {
          n = min(b, j);
          m = max(b, j);
          for (k = n + 1; k < m; k++)
            if (c[i][k] > 100 && c[i][k] < 444) l = 1;
        }
        if (l == 0) {
          c[i][j] += 1;
        }
      }
    }
  }
  a = q[0] - 97;
  b = q[1] - 49;
  for (i = 0; i < 8; i++) {
    for (j = 0; j < 8; j++) {
      if (i == a || b == j) {
        l = 0;
        if (b == j) {
          n = min(a, i);
          m = max(a, i);
          for (k = n + 1; k < m; k++)
            if (c[k][j] > 100 && c[k][j] < 444) l = 1;
        }
        if (a == i) {
          n = min(b, j);
          m = max(b, j);
          for (k = n + 1; k < m; k++)
            if (c[i][k] > 100 && c[i][k] < 444) l = 1;
        }
        if (l == 0) {
          c[i][j] += 2;
        }
      }
    }
  }
  a = r[0] - 97;
  b = r[1] - 49;
  for (i = 0; i < 8; i++) {
    for (j = 0; j < 8; j++) {
      if (abs(a - i) <= 1 && abs(b - j) <= 1) c[i][j] += 4;
    }
  }
  a = v[0] - 97;
  b = v[1] - 49;
  for (i = 0; i < 8; i++) {
    for (j = 0; j < 8; j++) {
      if (abs(a - i) <= 1 && abs(b - j) <= 1) {
        if (c[i][j] == 0 || c[i][j] == 444) {
          t = 1;
        }
      }
    }
  }
  if (t == 0) {
    if (abs(p[0] - v[0]) < 2 && abs(p[1] - v[1]) < 2) {
      if (c[p[0] - 97][p[1] - 49] == 112) t = 1;
    }
    if (abs(q[0] - v[0]) < 2 && abs(q[1] - v[1]) < 2) {
      if (c[q[0] - 97][q[1] - 49] == 224) t = 1;
    }
  }
  if (t == 1)
    cout << "OTHER";
  else
    cout << "CHECKMATE";
  return 0;
}
