#include <bits/stdc++.h>
using namespace std;
pair<int, int> go(string s) { return make_pair(s[0] - 'a', s[1] - '1'); }
int main() {
  int a[8][8];
  int b[8][8];
  memset(b, 0, sizeof(b));
  memset(a, 0, sizeof(a));
  string s;
  cin >> s;
  a[go(s).first][go(s).second] = 1;
  cin >> s;
  a[go(s).first][go(s).second] = 1;
  cin >> s;
  a[go(s).first][go(s).second] = 2;
  cin >> s;
  int n = 8;
  for (int i = 0; i < 8; i++)
    for (int j = 0; j < 8; j++)
      if (a[i][j] == 1) {
        int x = i, y = j;
        while (x > 0) {
          x--;
          b[x][y] = 1;
          if (a[x][y] != 0) break;
        }
        x = i;
        while (x < n - 1) {
          x++;
          b[x][y] = 1;
          if (a[x][y] != 0) break;
        }
        x = i;
        while (y > 0) {
          y--;
          b[x][y] = 1;
          if (a[x][y] != 0) break;
        }
        y = j;
        while (y < n - 1) {
          y++;
          b[x][y] = 1;
          if (a[x][y] != 0) break;
        }
      }
  int x, y;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++)
      if (a[i][j] == 2) {
        x = i;
        y = j;
      }
  for (int l = -1; l <= 1; l++)
    for (int k = -1; k <= 1; k++)
      if (!(l == 0 && k == 0) && x + l >= 0 && y + k >= 0 && x + l < n &&
          y + k < n)
        b[x + l][y + k] = 1;
  bool ok = false;
  x = go(s).first;
  y = go(s).second;
  for (int l = -1; l <= 1; l++)
    for (int k = -1; k <= 1; k++)
      if (!(l == 0 && k == 0) && x + l >= 0 && y + k >= 0 && x + l < n &&
          y + k < n && b[x + l][y + k] == 0)
        ok = true;
  if (!ok && b[x][y] == 1)
    cout << "CHECKMATE";
  else
    cout << "OTHER";
  return 0;
}
