#include <bits/stdc++.h>
using namespace std;
const int N = 1000006;
const int LOGN = (int)log2(N) + 2;
int SQRTN = (int)sqrt(N) + 7;
const long long infi = 1ll << 60;
long long n, m, k, x, y, idx, a, b, ans, tests;
string second, t;
vector<long long> vec, adj[N];
char grid[10][10];
bool isin(int x, int y) { return x >= 1 && x <= 8 && y >= 1 && y <= 8; }
bool checkmate(int x, int y) {
  char g[10][10];
  memset(g, 0, sizeof g);
  for (int(i) = (0); (i) <= (int)(9); ++(i))
    for (int(j) = (0); (j) <= (int)(9); ++(j)) g[i][j] = grid[i][j];
  g[x][y] = 'K';
  for (int(i) = (x - 1); (i) >= (1); --(i)) {
    if (g[i][y] == 'k') break;
    if (g[i][y] == 'r') return true;
  }
  for (int(i) = (x + 1); (i) <= (int)(8); ++(i)) {
    if (g[i][y] == 'k') break;
    if (g[i][y] == 'r') return true;
  }
  for (int(i) = (y - 1); (i) >= (1); --(i)) {
    if (g[x][i] == 'k') break;
    if (g[x][i] == 'r') return true;
  }
  for (int(i) = (y + 1); (i) <= (int)(8); ++(i)) {
    if (g[x][i] == 'k') break;
    if (g[x][i] == 'r') return true;
  }
  for (int(i) = (x - 1); (i) <= (int)(x + 1); ++(i)) {
    for (int(j) = (y - 1); (j) <= (int)(y + 1); ++(j)) {
      if (i == x && j == y) continue;
      if (!isin(i, j)) continue;
      if (g[i][j] == 'k') return true;
    }
  }
  return false;
}
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  ;
  cin >> second;
  x = second[0] - 'a' + 1, y = second[1] - '0';
  grid[x][y] = 'r';
  cin >> second;
  x = second[0] - 'a' + 1, y = second[1] - '0';
  grid[x][y] = 'r';
  cin >> second;
  x = second[0] - 'a' + 1, y = second[1] - '0';
  grid[x][y] = 'k';
  cin >> second;
  x = second[0] - 'a' + 1, y = second[1] - '0';
  for (int(i) = (x - 1); (i) <= (int)(x + 1); ++(i)) {
    for (int(j) = (y - 1); (j) <= (int)(y + 1); ++(j)) {
      if (!isin(i, j)) continue;
      if (!checkmate(i, j)) return cout << "OTHER" << endl, 0;
    }
  }
  cout << "CHECKMATE" << endl;
  return 0;
}
