#include <bits/stdc++.h>
using namespace std;
string a;
int y[4], z[4];
bool x[10][10];
bool b[10][10];
void go(int n, int m) {
  for (int i = n + 1; i <= 8 && !b[i][m]; i++) x[i][m] = false;
  for (int i = n - 1; i >= 1 && !b[i][m]; i--) x[i][m] = false;
  for (int i = m + 1; i <= 8 && !b[n][i]; i++) x[n][i] = false;
  for (int i = m - 1; i >= 1 && !b[n][i]; i--) x[n][i] = false;
}
int main() {
  memset(x, 0, sizeof x);
  memset(b, 0, sizeof b);
  for (int i = 1; i <= 8; i++)
    for (int j = 1; j <= 8; j++) x[i][j] = 1;
  for (int i = 0; i < 3; i++)
    cin >> a, y[i] = a[0] - 'a' + 1, z[i] = a[1] - '0', b[y[i]][z[i]] = 1;
  cin >> a, y[3] = a[0] - 'a' + 1, z[3] = a[1] - '0';
  go(y[0], z[0]), go(y[1], z[1]);
  if (y[0] == y[1] || z[0] == z[1]) {
    x[y[0]][z[0]] = false;
    x[y[1]][z[1]] = false;
  }
  x[y[2] + 1][z[2]] = 0, x[y[2] - 1][z[2]] = 0;
  x[y[2]][z[2] + 1] = 0, x[y[2]][z[2] - 1] = 0, x[y[2] + 1][z[2] + 1] = 0,
                 x[y[2] + 1][z[2] - 1] = 0, x[y[2] - 1][z[2] + 1] = 0,
                 x[y[2] - 1][z[2] - 1] = 0;
  if (x[y[3] + 1][z[3]] || x[y[3] - 1][z[3]] || x[y[3]][z[3] + 1] ||
      x[y[3]][z[3] - 1] || x[y[3] + 1][z[3] + 1] || x[y[3] + 1][z[3] - 1] ||
      x[y[3] - 1][z[3] + 1] || x[y[3] - 1][z[3] - 1] || x[y[3]][z[3]]) {
    puts("OTHER");
  } else {
    puts("CHECKMATE");
  }
  return 0;
}
