#include <bits/stdc++.h>
using namespace std;
const double EPS = 1e-06;
const int MAXN = 25;
pair<int, int> r, r2, bk, wk;
int dx[] = {1, -1, 0, 0, 1, 1, -1, -1};
int dy[] = {0, 0, 1, -1, -1, 1, 1, -1};
char board[10][10];
bool valid(int x, int y) { return x >= 0 && y >= 0 && x < 8 && y < 8; }
bool ok(int x, int y) {
  for (int i = 0; i < 8; i++) {
    for (int j = 0; j < 8; j++) {
      if (board[i][j] == 'R') {
        for (int k = 0; k < 4; k++) {
          int nx = i, ny = j;
          do {
            nx = nx + dx[k], ny = ny + dy[k];
          } while (valid(nx, ny) && board[nx][ny] == '.');
          if (valid(nx, ny) && board[nx][ny] == 'B') return false;
        }
      }
      if (board[i][j] == 'W') {
        for (int k = 0; k < 8; k++) {
          int nx = i + dx[k], ny = j + dy[k];
          if (valid(nx, ny) && board[nx][ny] == 'B') return false;
        }
      }
    }
  }
  return true;
}
bool check(int x, int y) {
  if (ok(x, y)) return false;
  bool mate = true;
  for (int i = 0; i < 8; i++) {
    int nx = x + dx[i], ny = y + dy[i];
    if (!valid(nx, ny)) continue;
    char tmp = board[nx][ny];
    board[nx][ny] = 'B';
    board[x][y] = '.';
    if (ok(nx, ny)) mate = false;
    board[nx][ny] = tmp;
    board[x][y] = 'B';
  }
  return mate;
}
pair<int, int> get(string a) { return pair<int, int>('8' - a[1], a[0] - 'a'); }
int main() {
  for (int i = 0; i < 8; i++)
    for (int j = 0; j < 8; j++) board[i][j] = '.';
  string tmp;
  cin >> tmp, board[get(tmp).first][get(tmp).second] = 'R';
  cin >> tmp, board[get(tmp).first][get(tmp).second] = 'R';
  cin >> tmp, board[get(tmp).first][get(tmp).second] = 'W';
  cin >> tmp, board[get(tmp).first][get(tmp).second] = 'B';
  bool ret = false;
  for (int i = 0; i < 8; i++) {
    for (int j = 0; j < 8; j++) {
      if (board[i][j] == 'B') ret = check(i, j);
    }
  }
  if (ret)
    cout << "CHECKMATE" << endl;
  else
    cout << "OTHER" << endl;
  return 0;
}
