#include <bits/stdc++.h>
using namespace std;
int a[10][10];
void Per(string s, int &x, int &y) {
  stringstream ss;
  ss << (s[0] - 'a');
  x = atoi(ss.str().c_str()) + 1;
  ss.str("");
  ss << s[1];
  y = 8 - atoi(ss.str().c_str()) + 1;
}
bool Prov(int x, int y) {
  if (a[y][x] == 0)
    return true;
  else {
    if (a[y][x + 1] == 0) return true;
    if (a[y][x - 1] == 0) return true;
    if (a[y + 1][x] == 0) return true;
    if (a[y + 1][x + 1] == 0) return true;
    if (a[y + 1][x - 1] == 0) return true;
    if (a[y - 1][x] == 0) return true;
    if (a[y - 1][x + 1] == 0) return true;
    if (a[y - 1][x - 1] == 0) return true;
    if ((a[y][x + 1] > 3) && (a[y][x + 1] != 9)) return true;
    if ((a[y][x - 1] > 3) && (a[y][x - 1] != 9)) return true;
    if ((a[y + 1][x] > 3) && (a[y + 1][x] != 9)) return true;
    if ((a[y + 1][x + 1] > 3) && (a[y + 1][x + 1] != 9)) return true;
    if ((a[y + 1][x - 1] > 3) && (a[y + 1][x - 1] != 9)) return true;
    if ((a[y - 1][x] > 3) && (a[y - 1][x] != 9)) return true;
    if ((a[y - 1][x + 1] > 3) && (a[y - 1][x + 1] != 9)) return true;
    if ((a[y - 1][x - 1] > 3) && (a[y - 1][x - 1] != 9)) return true;
    return false;
  }
}
int main() {
  int i, j;
  for (i = 0; i < 10; i++)
    for (j = 0; j < 10; j++) a[i][j] = 0;
  int x1, x2, x3, x4, y1, y2, y3, y4;
  string s;
  cin >> s;
  Per(s, x1, y1);
  cin >> s;
  Per(s, x2, y2);
  cin >> s;
  Per(s, x3, y3);
  cin >> s;
  Per(s, x4, y4);
  a[y3][x3] = 9;
  for (i = y1; i < 10; i++) {
    if (a[i][x1] == 9)
      break;
    else
      a[i][x1] = 1;
  }
  for (i = y1; i > -1; i--) {
    if (a[i][x1] == 9)
      break;
    else
      a[i][x1] = 1;
  }
  for (i = x1; i < 10; i++) {
    if (a[y1][i] == 9)
      break;
    else
      a[y1][i] = 1;
  }
  for (i = x1; i > -1; i--) {
    if (a[y1][i] == 9)
      break;
    else
      a[y1][i] = 1;
  }
  a[y1][x1] = 7;
  for (i = y2; i < 10; i++) {
    if (a[i][x2] == 9)
      break;
    else
      a[i][x2] = 1;
  }
  for (i = y2; i > -1; i--) {
    if (a[i][x2] == 9)
      break;
    else
      a[i][x2] = 1;
  }
  for (i = x2; i < 10; i++) {
    if (a[y2][i] == 9)
      break;
    else
      a[y2][i] = 1;
  }
  for (i = x2; i > -1; i--) {
    if (a[y2][i] == 9)
      break;
    else
      a[y2][i] = 1;
  }
  a[y2][x2] = 8;
  if (((x1 == x2) && ((x3 > x1) && (x3 > x2) || (x3 < x1) && (x3 < x2))) ||
      ((y1 == y2) && ((y3 > y1) && (y3 > y2) || (y3 < y1) && (y3 < y2)))) {
    a[y1][x1] = 9;
    a[y2][x2] = 9;
  }
  a[y3][x3 + 1] = 9;
  a[y3][x3 - 1] = 9;
  a[y3 + 1][x3] = 9;
  a[y3 + 1][x3 + 1] = 9;
  a[y3 + 1][x3 - 1] = 9;
  a[y3 - 1][x3] = 9;
  a[y3 - 1][x3 + 1] = 9;
  a[y3 - 1][x3 - 1] = 9;
  for (i = 0; i < 10; i++) {
    a[0][i] = -1;
    a[9][i] = -1;
    a[i][0] = -1;
    a[i][9] = -1;
  }
  bool f = Prov(x4, y4);
  if (f)
    cout << "OTHER\n";
  else
    cout << "CHECKMATE\n";
  return 0;
}
