#include <bits/stdc++.h>
using namespace std;
int mat[9][9];
int king[9][9];
int a[9][9];
void mark(int lin, int col) {
  if (lin + 1 <= 8) {
    king[lin + 1][col] = 1;
  }
  if (lin - 1 >= 1) {
    king[lin - 1][col] = 1;
  }
  if (col + 1 <= 8) {
    king[lin][col + 1] = 1;
  }
  if (col - 1 >= 1) {
    king[lin][col - 1] = 1;
  }
  if (lin + 1 <= 8 && col + 1 <= 8) {
    king[lin + 1][col + 1] = 1;
  }
  if (lin + 1 <= 8 && col - 1 >= 1) {
    king[lin + 1][col - 1] = 1;
  }
  if (lin - 1 >= 1 && col + 1 <= 8) {
    king[lin - 1][col + 1] = 1;
  }
  if (lin - 1 >= 1 && col - 1 >= 1) {
    king[lin - 1][col - 1] = 1;
  }
}
bool free(int lin, int col, int lin2, int col2) {
  bool pp = 1;
  int res = 0;
  for (int i = 1; i <= 8 && pp == 1; i++) {
    if (mat[i][col] > 0 && mat[i][col] <= 2 && i != lin) {
      res = i;
      pp = 0;
    }
  }
  if (pp == 0) {
    if (res > lin) {
      for (int i = lin + 1; i < res && pp == 0; i++) {
        if (a[i][col] != 0) {
          pp = 1;
        }
      }
    } else {
      for (int i = res + 1; i < lin && pp == 0; i++) {
        if (a[i][col] != 0) {
          pp = 1;
        }
      }
    }
  }
  if (pp == 1) {
    res = 0;
    for (int i = 1; i <= 8 && pp == 1; i++) {
      if (mat[lin][i] != 0 && i != col) {
        res = i;
        pp = 0;
      }
    }
    if (pp == 0) {
      if (res > col) {
        for (int i = col + 1; i < res && pp == 0; i++) {
          if (a[lin][i] != 0) {
            pp = 1;
          }
        }
      } else {
        for (int i = res + 1; i < col && pp == 0; i++) {
          if (a[lin][i] != 0) {
            pp = 1;
          }
        }
      }
    }
  }
  if (king[lin][col] == 1) {
    pp = 0;
  }
  return pp;
}
bool check(int lin, int col, int lin2, int col2) {
  int good = 0;
  if (lin + 1 <= 8) {
    if (free(lin + 1, col, lin2, col2) == 1) {
      good++;
    }
  }
  if (lin - 1 >= 1) {
    if (free(lin - 1, col, lin2, col2) == 1) {
      good++;
    }
  }
  if (col + 1 <= 8) {
    if (free(lin, col + 1, lin2, col2) == 1) {
      good++;
    }
  }
  if (col - 1 >= 1) {
    if (free(lin, col - 1, lin2, col2) == 1) {
      good++;
    }
  }
  if (lin + 1 <= 8 && col + 1 <= 8) {
    if (free(lin + 1, col + 1, lin2, col2) == 1) {
      good++;
    }
  }
  if (lin + 1 <= 8 && col - 1 >= 1) {
    if (free(lin + 1, col - 1, lin2, col2) == 1) {
      good++;
    }
  }
  if (lin - 1 >= 1 && col + 1 <= 8) {
    if (free(lin - 1, col + 1, lin2, col2) == 1) {
      good++;
    }
  }
  if (lin - 1 >= 1 && col - 1 >= 1) {
    if (free(lin - 1, col - 1, lin2, col2) == 1) {
      good++;
    }
  }
  if (good != 0) {
    return 1;
  } else {
    return 0;
  }
}
int main() {
  char c1, c2;
  int lin, col, lin2, col2;
  c1 = cin.get();
  c2 = cin.get();
  mat[c1 - 'a' + 1][c2 - '0'] = 1;
  cin.get();
  c1 = cin.get();
  c2 = cin.get();
  mat[c1 - 'a' + 1][c2 - '0'] = 2;
  cin.get();
  c1 = cin.get();
  c2 = cin.get();
  a[c1 - 'a' + 1][c2 - '0'] = 1;
  mark(c1 - 'a' + 1, c2 - '0');
  cin.get();
  c1 = cin.get();
  c2 = cin.get();
  lin = c1 - 'a' + 1;
  col = c2 - '0';
  if (free(lin, col, lin2, col2) == 1) {
    cout << "OTHER";
    return 0;
  }
  if (check(lin, col, lin2, col2) == 1) {
    cout << "OTHER";
  } else {
    cout << "CHECKMATE";
  }
  return 0;
}
