#include <bits/stdc++.h>
using namespace std;
int a[10][10];
void f(int x, int y) {
  int xx = x, yy = y;
  while (xx < 9 && a[xx + 1][yy] < 2) {
    a[xx][yy] = 1;
    ++xx;
  }
  xx = x, yy = y;
  while (yy < 9 && a[xx][yy + 1] < 2) {
    a[xx][yy] = 1;
    ++yy;
  }
  xx = x, yy = y;
  while (xx > 0 && a[xx - 1][yy] < 2) {
    a[xx][yy] = 1;
    --xx;
  }
  xx = x, yy = y;
  while (yy > 0 && a[xx][yy - 1] < 2) {
    a[xx][yy] = 1;
    --yy;
  }
}
void f1(int x, int y) {
  int xx = x, yy = y;
  while (xx < 9 && a[xx + 1][yy] < 2) {
    a[xx][yy] += 1;
    ++xx;
  }
  xx = x, yy = y;
  while (yy < 9 && a[xx][yy + 1] < 2) {
    a[xx][yy] += 1;
    ++yy;
  }
  xx = x, yy = y;
  while (xx > 0 && a[xx - 1][yy] < 2) {
    a[xx][yy] += 1;
    --xx;
  }
  xx = x, yy = y;
  while (yy > 0 && a[xx][yy - 1] < 2) {
    a[xx][yy] += 1;
    --yy;
  }
}
void f2(int x, int y) {
  a[x + 1][y] += 5;
  a[x - 1][y] += 5;
  a[x][y - 1] += 5;
  a[x][y + 1] += 5;
  a[x + 1][y + 1] += 5;
  a[x + 1][y - 1] += 5;
  a[x - 1][y + 1] += 5;
  a[x - 1][y - 1] += 5;
}
void check(int x, int y) {
  if (a[x][y] != 0) {
    if (x - 1 > 0 && a[x - 1][y] == 0)
      cout << "OTHER";
    else if (x + 1 < 9 && a[x + 1][y] == 0)
      cout << "OTHER";
    else if (y - 1 > 0 && a[x][y - 1] == 0)
      cout << "OTHER";
    else if (y + 1 < 9 && a[x][y + 1] == 0)
      cout << "OTHER";
    else if (x - 1 > 0 && y - 1 > 0 && a[x - 1][y - 1] == 0)
      cout << "OTHER";
    else if (x - 1 > 0 && y + 1 < 9 && a[x - 1][y + 1] == 0)
      cout << "OTHER";
    else if (x + 1 < 9 && y - 1 > 0 && a[x + 1][y - 1] == 0)
      cout << "OTHER";
    else if (x + 1 < 9 && y + 1 < 9 && a[x + 1][y + 1] == 0)
      cout << "OTHER";
    else {
      cout << "CHECKMATE";
    }
  } else
    cout << "OTHER";
}
int main() {
  char x;
  int y, k1x, k1y, k2x, k2y;
  int kx, ky, kx2, ky2;
  cin >> x >> y;
  k1x = y;
  k1y = (int)x - 96;
  cin >> x >> y;
  k2x = y;
  k2y = (int)x - 96;
  cin >> x >> y;
  kx = y;
  ky = (int)x - 96;
  cin >> x >> y;
  kx2 = y;
  ky2 = (int)x - 96;
  a[kx][ky] = 5;
  a[k1x][k1y] = 2;
  a[k2x][k2y] = 2;
  f(k1x, k1y);
  f1(k2x, k2y);
  if (k1x == k2x || k1y == k2y) {
    a[k1x][k1y] = 10000;
    a[k2x][k2y] = 10000;
  } else {
    a[k1x][k1y] = 0;
    a[k2x][k2y] = 0;
  }
  f2(kx, ky);
  check(kx2, ky2);
  return 0;
}
