#include <bits/stdc++.h>
using namespace std;
int a[10][10];
int w[8][2] = {
    {0, 1}, {0, -1}, {1, 1}, {1, -1}, {1, 0}, {-1, 0}, {-1, -1}, {-1, 1},
};
int main() {
  string s;
  cin >> s;
  int xr = s[0] - 'a', yr = s[1] - '1';
  cin >> s;
  int xrr = s[0] - 'a', yrr = s[1] - '1';
  cin >> s;
  int xw = s[0] - 'a', yw = s[1] - '1';
  cin >> s;
  int xb = s[0] - 'a', yb = s[1] - '1';
  for (int i = yr + 1; i < 8; i++) {
    if (xr == xw && yr == i) break;
    a[xr][i] = 1;
  }
  for (int i = yr - 1; i >= 0; i--) {
    if (xr == xw && yr == i) break;
    a[xr][i] = 1;
  }
  for (int i = xr + 1; i < 8; i++) {
    if (xw == i && yr == yw) break;
    a[i][yr] = 1;
  }
  for (int i = xr - 1; i >= 0; i--) {
    if (xw == i && yr == yw) break;
    a[i][yr] = 1;
  }
  for (int i = xrr + 1; i < 8; i++) {
    if (xw == i && yrr == yw) break;
    a[i][yrr] = 1;
  }
  for (int i = xrr - 1; i >= 0; i--) {
    if (xw == i && yrr == yw) break;
    a[i][yrr] = 1;
  }
  for (int i = yrr + 1; i < 8; i++) {
    if (xrr == xw && yw == i) break;
    a[xrr][i] = 1;
  }
  for (int i = yrr - 1; i >= 0; i--) {
    if (xrr == xw && yw == i) break;
    a[xrr][i] = 1;
  }
  for (int i = 0; i < 8; i++) {
    int xx = xw + w[i][0], yy = yw + w[i][1];
    if (xx >= 0 && xx < 8 && yy >= 0 && yy < 8) a[xx][yy] = 1;
  }
  if (a[xb][yb] == 0) {
    cout << "OTHER" << endl;
    return 0;
  }
  for (int i = 0; i < 8; i++) {
    int xx = xb + w[i][0], yy = yb + w[i][1];
    if (xx >= 0 && xx < 8 && yy >= 0 && yy < 8 && !a[xx][yy]) {
      cout << "OTHER" << endl;
      return 0;
    }
  }
  cout << "CHECKMATE" << endl;
  return 0;
}
