#include <bits/stdc++.h>
using namespace std;
int w[2][2];
int kb[2], kc[2];
int size[10][10];
string s;
int main() {
  ios_base::sync_with_stdio(0);
  for (int i = 0; i <= (int)(2) - 1; i++) {
    cin >> s;
    w[i][0] = s[0] - 'a';
    w[i][1] = s[1] - '1';
  }
  cin >> s;
  kb[0] = s[0] - 'a';
  kb[1] = s[1] - '1';
  cin >> s;
  kc[0] = s[0] - 'a';
  kc[1] = s[1] - '1';
  for (int i = 0; i <= (int)(10) - 1; i++)
    for (int j = 0; j <= (int)(10) - 1; j++) size[i][j] = 0;
  int x, y;
  for (int ii = 0; ii <= (int)(2) - 1; ii++) {
    for (int i = w[ii][0] + 1; i <= 7; i++) {
      if (i == kb[0] && w[ii][1] == kb[1]) break;
      size[i][w[ii][1]] = 1;
    }
    for (int i = w[ii][0] - 1; i >= 0; i--) {
      if (i == kb[0] && w[ii][1] == kb[1]) break;
      size[i][w[ii][1]] = 1;
    }
    for (int j = w[ii][1] + 1; j <= 7; j++) {
      if (w[ii][0] == kb[0] && j == kb[1]) break;
      size[w[ii][0]][j] = 1;
    }
    for (int j = w[ii][1] - 1; j >= 0; j--) {
      if (w[ii][0] == kb[0] && j == kb[1]) break;
      size[w[ii][0]][j] = 1;
    }
  }
  for (int i = -1; i <= 1; i++)
    for (int j = -1; j <= 1; j++) {
      int a = i + kb[0], b = j + kb[1];
      if (a >= 0 && a < 8 && b >= 0 && b < 8) {
        size[a][b] = 1;
      }
    }
  for (int i = -1; i <= 1; i++)
    for (int j = -1; j <= 1; j++) {
      int a = i + kc[0], b = j + kc[1];
      if (a >= 0 && a < 8 && b >= 0 && b < 8) {
        if (size[a][b]) {
        } else {
          cout << "OTHER\n";
          return 0;
        }
      }
    }
  cout << "CHECKMATE\n";
  return 0;
}
