//============================================================================
// Name        : [email protected]	Game of chess unfinished
// Author      : LiJunLe
// Version     : Accepted
// Copyright   : Your copyright notice
// Description : http://www.codeforces.com/contest/42/problem/B
//============================================================================

#include <iostream>
#include <stdio.h>

using namespace std;

int dx[9] = {-1,-1,-1,+0,+0,+1,+1,+1, 0};
int dy[9] = {-1,+0,+1,-1,+1,-1,+0,+1, 0};

struct Point
{
    int x, y;

    Point (int _x=0, int _y=0) {
    	x = _x;
    	y = _y;
    }

    inline void getScanf()
    {
        char pos[3];
        scanf("%s", pos);
        x = pos[0] - 'a';
        y = pos[1] - '1';
    }

    bool operator==(Point o)
    {
        if (x == o.x && y == o.y)
        {
            return true;
        }
        else
        {
            return false;
        }
    }
};

Point rook[2], king[2];

bool rookHit(Point a, Point b)
{
    if (a.x == b.x)
    {
    	if (king[0].x == a.x) {
    		if (king[0].y < min(a.y, b.y) || king[0].y > max(a.y, b.y)) {
    			return true;
    		}
    	}
    	else {
    		return true;
    	}
    }
    if (a.y == b.y)
    {
    	if (king[0].y == a.y) {
    		if (king[0].x < min(a.x, b.x) || king[0].x > max(a.x, b.x)) {
    			return true;
    		}
    	}
    	else {
    		return true;
    	}
    }
    return false;
}

bool kingHit(Point a, Point b)
{
    for (int i = 0; i < 8; i++)
    {
        Point next(a.x + dx[i], a.y + dy[i]);
        if (next.x < 0 || next.x > 7 || next.y < 0 || next.y > 7)
        {
            continue;
        }
        if (next == b)
        {
            return true;
        }
    }
    return false;
}

int main()
{
    int i;
    for (i = 0; i < 2; i ++) {
        rook[i].getScanf();
    }
    for (i = 0; i < 2; i ++) {
        king[i].getScanf();
    }
    bool flag = true;
    for (i = 0; i < 9; i ++) {
		Point next(king[1].x + dx[i], king[1].y + dy[i]);
		if (next.x < 0 || next.x > 7 || next.y < 0 || next.y > 7)
		{
			continue;
		}
		for (int j = 0; j < 2; j ++) {
			if (next == rook[j]) {
				if (kingHit(king[0], next) == false && rookHit(rook[1-j], next) == false) {
					flag = false;
				}
			}
		}
		if (kingHit(king[0], next) == false &&
			rookHit(rook[0], next) == false &&
			rookHit(rook[1], next) == false) {
			flag = false;
		}
	}
    if (flag) {
        puts("CHECKMATE");
    }
    else {
        puts("OTHER");
    }
    return 0;
}