#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  char rook1input[5], rook2input[5], kingBinput[5], kingWinput[5];
  cin >> rook1input >> rook2input >> kingWinput >> kingBinput;
  int dp[10][10] = {0};
  for (int i = 0; i < 10; i++) {
    dp[0][i] = 1;
    dp[9][i] = 1;
  }
  for (int i = 0; i < 10; i++) {
    dp[i][0] = 1;
    dp[i][9] = 1;
  }
  int Wx = kingWinput[0] - 'a' + 1;
  int Wy = kingWinput[1] - '0';
  dp[Wx][Wy] = 3;
  dp[Wx - 1][Wy + 1] = 1;
  dp[Wx + 1][Wy - 1] = 1;
  dp[Wx + 1][Wy] = 1;
  dp[Wx + 1][Wy + 1] = 1;
  dp[Wx][Wy + 1] = 1;
  dp[Wx - 1][Wy] = 1;
  dp[Wx - 1][Wy - 1] = 1;
  dp[Wx][Wy - 1] = 1;
  int rook2[2] = {rook2input[0] - 'a' + 1, rook2input[1] - '0'};
  dp[rook2[0]][rook2[1]] = 2;
  bool flag = false;
  if (dp[rook2[0]][rook2[1]] == 3)
    flag = true;
  else if (dp[rook2[0] + 1][rook2[1]] == 3)
    flag = true;
  else if (dp[rook2[0] + 1][rook2[1] + 1] == 3)
    flag = true;
  else if (dp[rook2[0]][rook2[1] + 1] == 3)
    flag = true;
  else if (dp[rook2[0] - 1][rook2[1] + 1] == 3)
    flag = true;
  else if (dp[rook2[0] - 1][rook2[1]] == 3)
    flag = true;
  else if (dp[rook2[0] - 1][rook2[1] - 1] == 3)
    flag = true;
  else if (dp[rook2[0]][rook2[1] - 1] == 3)
    flag = true;
  else if (dp[rook2[0] + 1][rook2[1] - 1] == 3)
    flag = true;
  if (flag) dp[rook2[0]][rook2[1]] = 4;
  int rook1[2] = {rook1input[0] - 'a' + 1, rook1input[1] - '0'};
  dp[rook1[0]][rook1[1]] = 2;
  flag = false;
  if (dp[rook1[0]][rook2[1]] == 3)
    flag = true;
  else if (dp[rook1[0] + 1][rook1[1]] == 3)
    flag = true;
  else if (dp[rook1[0] + 1][rook1[1] + 1] == 3)
    flag = true;
  else if (dp[rook1[0]][rook1[1] + 1] == 3)
    flag = true;
  else if (dp[rook1[0] - 1][rook1[1] + 1] == 3)
    flag = true;
  else if (dp[rook1[0] - 1][rook1[1]] == 3)
    flag = true;
  else if (dp[rook1[0] - 1][rook1[1] - 1] == 3)
    flag = true;
  else if (dp[rook1[0]][rook1[1] - 1] == 3)
    flag = true;
  else if (dp[rook1[0] + 1][rook1[1] - 1] == 3)
    flag = true;
  if (flag) dp[rook1[0]][rook1[1]] = 4;
  for (int i = rook1[0] - 1; i > 0; i--) {
    if (dp[i][rook1[1]] == 0) {
      dp[i][rook1[1]] = 1;
    } else if (dp[i][rook1[1]] == 3) {
      break;
    } else if (dp[i][rook1[1]] == 2 || dp[i][rook1[1]] == 4) {
      dp[rook1[0]][rook1[1]] = 4;
    }
  }
  for (int i = rook1[0] + 1; i < 9; i++) {
    if (dp[i][rook1[1]] == 0) {
      dp[i][rook1[1]] = 1;
    } else if (dp[i][rook1[1]] == 3) {
      break;
    } else if (dp[i][rook1[1]] == 2 || dp[i][rook1[1]] == 4) {
      dp[rook1[0]][rook1[1]] = 4;
    }
  }
  for (int i = rook1[1] - 1; i > 0; i--) {
    if (dp[rook1[0]][i] == 0) {
      dp[rook1[0]][i] = 1;
    } else if (dp[rook1[0]][i] == 3) {
      break;
    } else if (dp[rook1[0]][i] == 2 || dp[rook1[0]][i] == 4) {
      dp[rook1[0]][rook1[1]] = 4;
    }
  }
  for (int i = rook1[1] + 1; i < 9; i++) {
    if (dp[rook1[0]][i] == 0) {
      dp[rook1[0]][i] = 1;
    } else if (dp[rook1[0]][i] == 3) {
      break;
    } else if (dp[rook1[0]][i] == 2 || dp[rook1[0]][i] == 4) {
      dp[rook1[0]][rook1[1]] = 4;
    }
  }
  for (int i = rook2[0] - 1; i > 0; i--) {
    if (dp[i][rook2[1]] == 0) {
      dp[i][rook2[1]] = 1;
    } else if (dp[i][rook2[1]] == 3) {
      break;
    } else if (dp[i][rook2[1]] == 2 || dp[i][rook2[1]] == 4) {
      dp[rook2[0]][rook2[1]] = 4;
    }
  }
  for (int i = rook2[0] + 1; i < 9; i++) {
    if (dp[i][rook2[1]] == 0) {
      dp[i][rook2[1]] = 1;
    } else if (dp[i][rook2[1]] == 3) {
      break;
    } else if (dp[i][rook2[1]] == 2 || dp[i][rook2[1]] == 4) {
      dp[rook2[0]][rook2[1]] = 4;
    }
  }
  for (int i = rook2[1] - 1; i > 0; i--) {
    if (dp[rook2[0]][i] == 0) {
      dp[rook2[0]][i] = 1;
    } else if (dp[rook2[0]][i] == 3) {
      break;
    } else if (dp[rook2[0]][i] == 2 || dp[rook2[0]][i] == 4) {
      dp[rook2[0]][rook2[1]] = 4;
    }
  }
  for (int i = rook2[1] + 1; i < 9; i++) {
    if (dp[rook2[0]][i] == 0) {
      dp[rook2[0]][i] = 1;
    } else if (dp[rook2[0]][i] == 3) {
      break;
    } else if (dp[rook2[0]][i] == 2 || dp[rook2[0]][i] == 4) {
      dp[rook2[0]][rook2[1]] = 4;
    }
  }
  int kb[2] = {kingBinput[0] - 'a' + 1, kingBinput[1] - '0'};
  if (dp[kb[0]][kb[1]] == 0 || dp[kb[0]][kb[1]] == 2)
    cout << "OTHER" << endl;
  else if (dp[kb[0] + 1][kb[1]] == 0 || dp[kb[0] + 1][kb[1]] == 2)
    cout << "OTHER" << endl;
  else if (dp[kb[0] + 1][kb[1] + 1] == 0 || dp[kb[0] + 1][kb[1] + 1] == 2)
    cout << "OTHER" << endl;
  else if (dp[kb[0]][kb[1] + 1] == 0 || dp[kb[0]][kb[1] + 1] == 2)
    cout << "OTHER" << endl;
  else if (dp[kb[0] - 1][kb[1] + 1] == 0 || dp[kb[0] - 1][kb[1] + 1] == 2)
    cout << "OTHER" << endl;
  else if (dp[kb[0] - 1][kb[1]] == 0 || dp[kb[0] - 1][kb[1]] == 2)
    cout << "OTHER" << endl;
  else if (dp[kb[0] - 1][kb[1] - 1] == 0 || dp[kb[0] - 1][kb[1] - 1] == 2)
    cout << "OTHER" << endl;
  else if (dp[kb[0]][kb[1] - 1] == 0 || dp[kb[0]][kb[1] - 1] == 2)
    cout << "OTHER" << endl;
  else if (dp[kb[0] + 1][kb[1] - 1] == 0 || dp[kb[0] + 1][kb[1] - 1] == 2)
    cout << "OTHER" << endl;
  else
    cout << "CHECKMATE" << endl;
  return 0;
}
