#include <bits/stdc++.h>
using namespace std;
const long long inf = 1e18;
const int mod = 1e9 + 7;
int bad[10][10];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  for (int i = 0; i < 10; i++) {
    for (int j = 0; j < 10; j++) {
      bad[i][j] = 1;
    }
  }
  for (int i = 1; i <= 8; i++) {
    for (int j = 1; j <= 8; j++) {
      bad[i][j] = 0;
    }
  }
  string l1, l2, kb, kw;
  cin >> l1 >> l2 >> kw >> kb;
  int x = l1[0] - 'a' + 1, y = 9 - (l1[1] - '0');
  swap(x, y);
  bad[x][y] = 228;
  x = l2[0] - 'a' + 1, y = 9 - (l2[1] - '0');
  swap(x, y);
  bad[x][y] = 228;
  x = kw[0] - 'a' + 1, y = 9 - (kw[1] - '0');
  swap(x, y);
  bad[x][y] = 228;
  bad[x][y - 1] = 1;
  bad[x][y + 1] = 1;
  bad[x - 1][y] = 1;
  bad[x - 1][y + 1] = 1;
  bad[x - 1][y - 1] = 1;
  bad[x + 1][y] = 1;
  bad[x + 1][y + 1] = 1;
  bad[x + 1][y - 1] = 1;
  x = l1[0] - 'a' + 1, y = 9 - (l1[1] - '0');
  swap(x, y);
  for (int i = y - 1; i > 0; i--) {
    if (bad[x][i] == 228) {
      bad[x][i] = 1;
      break;
    }
    bad[x][i] = 1;
  }
  for (int i = y + 1; i < 9; i++) {
    if (bad[x][i] == 228) {
      bad[x][i] = 1;
      break;
    }
    bad[x][i] = 1;
  }
  for (int i = x - 1; i > 0; i--) {
    if (bad[i][y] == 228) {
      bad[i][y] = 1;
      break;
    }
    bad[i][y] = 1;
  }
  for (int i = x + 1; i < 9; i++) {
    if (bad[i][y] == 228) {
      bad[i][y] = 1;
      break;
    }
    bad[i][y] = 1;
  }
  x = l2[0] - 'a' + 1, y = 9 - (l2[1] - '0');
  swap(x, y);
  for (int i = y - 1; i > 0; i--) {
    if (bad[x][i] == 228) {
      bad[x][i] = 1;
      break;
    }
    bad[x][i] = 1;
  }
  for (int i = y + 1; i < 9; i++) {
    if (bad[x][i] == 228) {
      bad[x][i] = 1;
      break;
    }
    bad[x][i] = 1;
  }
  for (int i = x - 1; i > 0; i--) {
    if (bad[i][y] == 228) {
      bad[i][y] = 1;
      break;
    }
    bad[i][y] = 1;
  }
  for (int i = x + 1; i < 9; i++) {
    if (bad[i][y] == 228) {
      bad[i][y] = 1;
      break;
    }
    bad[i][y] = 1;
  }
  x = kb[0] - 'a' + 1, y = 9 - (kb[1] - '0');
  swap(x, y);
  if (!bad[x][y] || !bad[x][y - 1] || !bad[x][y + 1] || !bad[x - 1][y] ||
      !bad[x - 1][y - 1] || !bad[x - 1][y + 1] || !bad[x + 1][y] ||
      !bad[x + 1][y - 1] || !bad[x + 1][y + 1]) {
    cout << "OTHER" << endl;
    return 0;
  }
  if (bad[x][y] == 228 || bad[x][y - 1] == 228 || bad[x][y + 1] == 228 ||
      bad[x - 1][y] == 228 || bad[x - 1][y - 1] == 228 ||
      bad[x - 1][y + 1] == 228 || bad[x + 1][y] == 228 ||
      bad[x + 1][y - 1] == 228 || bad[x + 1][y + 1] == 228) {
    cout << "OTHER" << endl;
    return 0;
  }
  cout << "CHECKMATE" << endl;
}
