#include <bits/stdc++.h>
using namespace std;
string s1, s2, s3, s4;
char c[181][181];
int abcd, ABCD, x2, y2, x3, y3, x4, y4, i, j;
bool check(int x, int y) { return (1 <= x && x <= 8 && 1 <= y && y <= 8); }
bool f(int x, int y) {
  int abcd = x, ABCD = y;
  x = abcd + 1;
  y = ABCD;
  while (x <= 8) {
    if (c[x][y] == 'C') return 1;
    if (c[x][y] != '.') break;
    x++;
  }
  x = abcd;
  y = ABCD + 1;
  while (y <= 8) {
    if (c[x][y] == 'C') return 1;
    if (c[x][y] != '.') break;
    y++;
  }
  x = abcd - 1;
  y = ABCD;
  while (x >= 1) {
    if (c[x][y] == 'C') return 1;
    if (c[x][y] != '.') break;
    x--;
  }
  x = abcd;
  y = ABCD - 1;
  while (y >= 1) {
    if (c[x][y] == 'C') return 1;
    if (c[x][y] != '.') break;
    y--;
  }
  return 0;
}
bool f1(int x, int y) {
  int i, j;
  for (i = max(x - 1, 1); i <= min(x + 1, 8); i++)
    for (j = max(y - 1, 1); j <= min(y + 1, 8); j++)
      if (c[i][j] == 'C') return 1;
  return 0;
}
bool can(int x, int y) {
  if (!check(x, y)) return 0;
  int i, j;
  for (i = 1; i <= 8; i++)
    for (j = 1; j <= 8; j++) c[i][j] = '.';
  c[abcd][ABCD] = c[x2][y2] = 'A';
  c[x3][y3] = 'B';
  c[x][y] = 'C';
  for (i = 1; i <= 8; i++)
    for (j = 1; j <= 8; j++) {
      if (c[i][j] == 'A' && f(i, j)) return 0;
      if (c[i][j] == 'B' && f1(i, j)) return 0;
    }
  return 1;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> s1 >> s2 >> s3 >> s4;
  abcd = s1[0] - 96;
  ABCD = s1[1] - 48;
  x2 = s2[0] - 96;
  y2 = s2[1] - 48;
  x3 = s3[0] - 96;
  y3 = s3[1] - 48;
  x4 = s4[0] - 96;
  y4 = s4[1] - 48;
  for (i = -1; i <= 1; i++)
    for (j = -1; j <= 1; j++)
      if (can(x4 + i, y4 + j)) {
        cout << "OTHER" << '\n';
        return 0;
      }
  cout << "CHECKMATE" << '\n';
  return 0;
}
