#include <bits/stdc++.h>
using namespace std;
int w[8][8] = {};
int p[8][8] = {};
void rook(int x, int y) {
  w[x][y] = 1;
  for (int i = 1; i < 8 && x - i >= 0 && !p[x - i][y]; i++) w[x - i][y] = 1;
  for (int i = 1; i < 8 && x + i < 8 && !p[x + i][y]; i++) w[x + i][y] = 1;
  for (int i = 1; i < 8 && y - i >= 0 && !p[x][y - i]; i++) w[x][y - i] = 1;
  for (int i = 1; i < 8 && y + i < 8 && !p[x][y + i]; i++) w[x][y + i] = 1;
}
int king(int x, int y) {
  int ret = 0;
  for (int i = -1; i <= 1; i++)
    for (int j = -1; j <= 1; j++)
      if (x + i >= 0 && x + i < 8 && y + j >= 0 && y + j < 8)
        ret += (w[x + i][y + j]++ == 0);
  return ret;
}
int main(void) {
  char a[4][4];
  for (int i = 0; i < 4; i++) scanf("%s", a[i]);
  int x = a[3][0] - 'a', y = a[3][1] - '1';
  int u = abs(x - (a[2][0] - 'a'));
  int v = abs(y - (a[2][1] - '1'));
  if (u <= 1 && v <= 1) {
    puts("OTHER");
    return 0;
  }
  for (int i = -1; i <= 1; i++)
    for (int j = -1; j <= 1; j++)
      if (x + i >= 0 && x + i < 8 && y + j >= 0 && y + j < 8) {
        memset(w, 0, sizeof(w));
        memset(p, 0, sizeof(p));
        if (x + i != a[0][0] - 'a' || y + j != a[0][1] - '1')
          p[a[0][0] - 'a'][a[0][1] - '1'] = 1;
        if (x + i != a[1][0] - 'a' || y + j != a[1][1] - '1')
          p[a[1][0] - 'a'][a[1][1] - '1'] = 1;
        p[a[2][0] - 'a'][a[2][1] - '1'] = 1;
        if (x + i != a[0][0] - 'a' || y + j != a[0][1] - '1')
          rook(a[0][0] - 'a', a[0][1] - '1');
        if (x + i != a[1][0] - 'a' || y + j != a[1][1] - '1')
          rook(a[1][0] - 'a', a[1][1] - '1');
        king(a[2][0] - 'a', a[2][1] - '1');
        if (w[x + i][y + j] == 0) {
          puts("OTHER");
          return 0;
        }
      }
  puts("CHECKMATE");
  return 0;
}
