#include <bits/stdc++.h>
using namespace std;
int a[10][10];
int sx, sy;
bool check(int x, int y) {
  if (x < 1 || x > 8 || y < 1 || y > 8) return true;
  for (int i = -1; i <= 1; i++)
    for (int j = -1; j <= 1; j++)
      if (a[x + i][y + j] == 1) return true;
  for (int i = 1; i <= 8; i++) {
    for (int i = x - 1; i >= 1; i--) {
      if (a[i][y] == 1) break;
      if (a[i][y] == 3) return true;
    }
    for (int i = x + 1; i <= 8; i++) {
      if (a[i][y] == 1) break;
      if (a[i][y] == 3) return true;
    }
    for (int i = y - 1; i >= 1; i--) {
      if (a[x][i] == 1) break;
      if (a[x][i] == 3) return true;
    }
    for (int i = y + 1; i <= 8; i++) {
      if (a[x][i] == 1) break;
      if (a[x][i] == 3) return true;
    }
  }
  return false;
}
int main() {
  char x, y;
  cin >> x >> y;
  a[x - 'a' + 1][y - '0'] = 3;
  cin >> x >> y;
  a[x - 'a' + 1][y - '0'] = 3;
  cin >> x >> y;
  a[x - 'a' + 1][y - '0'] = 1;
  cin >> x >> y;
  a[x - 'a' + 1][y - '0'] = 2;
  sx = x - 'a' + 1;
  sy = y - '0';
  for (int i = -1; i <= 1; i++)
    for (int j = -1; j <= 1; j++)
      if (!check(sx + i, sy + j)) {
        cout << "OTHER" << endl;
        return 0;
      }
  cout << "CHECKMATE" << endl;
}
