#include <bits/stdc++.h>
using namespace std;
void ONLINE__JUDGE();
const int mod = 998244353;
const int MAX = 1e5 + 9;
vector<pair<long long, long long> > vec;
long long Br, Bc, Wr, Wc;
char arr[10][10];
string x;
bool isSafe[10][10];
void setPieces(string s, char symbol) {
  long long row = 8 - (s[1] - '0') + 1, col = s[0] - 'a' + 1;
  arr[row][col] = symbol;
  if (symbol == 'R') vec.push_back({row, col});
  if (symbol == 'B') Br = row, Bc = col;
  if (symbol == 'W') Wr = row, Wc = col;
}
int main() {
  ios::sync_with_stdio(NULL);
  cin.tie(NULL);
  ONLINE__JUDGE();
  for (int i = 0; i < 10; i++)
    for (int j = 0; j < 10; j++) arr[i][j] = '.', isSafe[i][j] = 1;
  for (int i = 0; i < 2; i++) cin >> x, setPieces(x, 'R');
  cin >> x, setPieces(x, 'W');
  cin >> x, setPieces(x, 'B');
  for (auto p : vec) {
    long long row = p.first, col = p.second;
    for (int i = row - 1; i > 0; i--)
      if (arr[i][col] != 'W')
        isSafe[i][col] = 0;
      else
        break;
    for (int i = row + 1; i < 9; i++)
      if (arr[i][col] != 'W')
        isSafe[i][col] = 0;
      else
        break;
    for (int i = col - 1; i > 0; i--)
      if (arr[row][i] != 'W')
        isSafe[row][i] = 0;
      else
        break;
    for (int i = col + 1; i < 9; i++)
      if (arr[row][i] != 'W')
        isSafe[row][i] = 0;
      else
        break;
  }
  for (int i = Wr - 1; i <= Wr + 1; i++)
    for (int j = Wc - 1; j <= Wc + 1; j++)
      if (i >= 1 && i <= 8 && j >= 1 && j <= 8) isSafe[i][j] = 0;
  for (int i = Br - 1; i <= Br + 1; i++)
    for (int j = Bc - 1; j <= Bc + 1; j++)
      if (i >= 1 && i <= 8 && j >= 1 && j <= 8 && isSafe[i][j] == 1) {
        cout << "OTHER";
        return 0;
      }
  cout << "CHECKMATE";
  return 0;
}
void ONLINE__JUDGE() {}
