#include <bits/stdc++.h>
using namespace std;
string s[] = {"OTHER", "CHECKMATE"};
int dx[] = {0, 1, 0, -1, -1, -1, 1, 1};
int dy[] = {1, 0, -1, 0, -1, 1, -1, 1};
int a[5], b[5];
int board[20][20];
bool in(int x, int y) { return x >= 1 && x <= 8 && y >= 1 && y <= 8; }
void read(int& xx, int& yy) {
  char x, y;
  cin >> x >> y;
  xx = x - 'a' + 1, yy = y - '0';
}
bool lose(int x, int y) {
  for (int(k) = 0; (k) < (8); (k)++) {
    int tx = x + dx[k], ty = y + dy[k];
    if (board[tx][ty] == 2) return 1;
  }
  for (int(i) = 0; (i) < (4); (i)++) {
    int tx = x + dx[i], ty = y + dy[i];
    while (board[tx][ty] != 2 && in(tx, ty)) {
      if (board[tx][ty] == 1) return 1;
      tx += dx[i], ty += dy[i];
    }
  }
  return 0;
}
int main() {
  for (int(i) = 1; (i) <= (4); (i)++) read(a[i], b[i]);
  for (int(i) = 1; (i) <= (2); (i)++) board[a[i]][b[i]] = 1;
  board[a[3]][b[3]] = 2;
  if (!lose(a[4], b[4])) {
    puts("OTHER");
    return 0;
  }
  for (int(k) = 0; (k) < (8); (k)++) {
    int tx = a[4] + dx[k], ty = b[4] + dy[k];
    if (!in(tx, ty)) continue;
    int tp = board[tx][ty];
    board[tx][ty] = 0;
    if (!lose(tx, ty)) {
      puts("OTHER");
      return 0;
    }
    board[tx][ty] = tp;
  }
  puts("CHECKMATE");
  return 0;
}
