#include <bits/stdc++.h>
using namespace std;
int A[10][10];
int B[10][10];
string s;
int main() {
  cin >> s;
  int a1 = s[0] - 'a', b1 = s[1] - '1';
  B[a1][b1] = 1;
  cin >> s;
  int a2 = s[0] - 'a', b2 = s[1] - '1';
  B[a2][b2] = 1;
  cin >> s;
  int a3 = s[0] - 'a', b3 = s[1] - '1';
  B[a3][b3] = 2;
  cin >> s;
  int a4 = s[0] - 'a', b4 = s[1] - '1';
  B[a4][b4] = 3;
  int a = a1, b = b1;
  for (int i = a + 1; i < 8; i++)
    if (B[i][b] != 2)
      A[i][b] = 1;
    else
      break;
  for (int i = a - 1; i >= 0; i--)
    if (B[i][b] != 2)
      A[i][b] = 1;
    else
      break;
  for (int i = b + 1; i < 8; i++)
    if (B[a][i] != 2)
      A[a][i] = 1;
    else
      break;
  for (int i = b - 1; i >= 0; i--)
    if (B[a][i] != 2)
      A[a][i] = 1;
    else
      break;
  a = a2;
  b = b2;
  for (int i = a + 1; i < 8; i++)
    if (B[i][b] != 2)
      A[i][b] = 1;
    else
      break;
  for (int i = a - 1; i >= 0; i--)
    if (B[i][b] != 2)
      A[i][b] = 1;
    else
      break;
  for (int i = b + 1; i < 8; i++)
    if (B[a][i] != 2)
      A[a][i] = 1;
    else
      break;
  for (int i = b - 1; i >= 0; i--)
    if (B[a][i] != 2)
      A[a][i] = 1;
    else
      break;
  a = a3;
  b = b3;
  for (int i = 0; i < (int)(3); i++)
    for (int j = 0; j < (int)(3); j++) {
      if (a + i - 1 >= 0 && a + i - 1 < 8 && b + j - 1 >= 0 && b + j - 1 < 8) {
        A[a + i - 1][b + j - 1] = 1;
      }
    }
  int bb = 0;
  a = a4;
  b = b4;
  for (int i = 0; i < (int)(3); i++)
    for (int j = 0; j < (int)(3); j++) {
      if (a + i - 1 >= 0 && a + i - 1 < 8 && b + j - 1 >= 0 && b + j - 1 < 8) {
        if (A[a + i - 1][b + j - 1] != 1) {
          bb = 1;
        }
      }
    }
  if (!bb)
    cout << "CHECKMATE";
  else
    cout << "OTHER";
}
