#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;


#define max_H 16
#define max_W 64

enum DIR{
	North,
	East,
	South,
	West,
};

struct Info{
	Info(){
		row = 0;
		col = 0;
		dir = North;
	}
	Info(int arg_row,int arg_col,DIR arg_dir){
		row = arg_row;
		col = arg_col;
		dir = arg_dir;
	}
	void set(int arg_row,int arg_col){
		row = arg_row;
		col = arg_col;
	}
	int row,col;
	DIR dir;
};

struct Data{
	Data(int arg_go_row,int arg_go_col,DIR arg_go_dir,int arg_return_row,int arg_return_col,DIR arg_return_dir){
		go_row = arg_go_row;
		go_col = arg_go_col;
		go_dir = arg_go_dir;
		return_row = arg_return_row;
		return_col = arg_return_col;
		return_dir = arg_return_dir;
	}
	int go_row,go_col,return_row,return_col;
	DIR go_dir,return_dir;
};

int H,W;

DIR dir_array[4] = {North,East,South,West};
int diff_row[4] = {-1,0,1,0},diff_col[4] = {0,1,0,-1};
char base_map[max_H][max_W+1];
bool first_check[max_H][max_W][4],check[max_H][max_W][4][max_H][max_W][4];
Info start,goal;
vector<Info> L_ORIGIN[max_H][max_W][4],R_ORIGIN[max_H][max_W][4];

Info get_next_state(int current_row,int current_col,DIR to_dir){

	Info ret;
	ret.set(current_row,current_col);
	ret.dir = to_dir;

	while(true){

		if(base_map[ret.row+diff_row[to_dir]][ret.col+diff_col[to_dir]] != '.')break;

		ret.row += diff_row[to_dir];
		ret.col += diff_col[to_dir];
	}
	return ret;
}

DIR get_Left(DIR dir){

	return dir_array[(dir-1+4)%4];
}

DIR get_Right(DIR dir){

	return dir_array[(dir+1)%4];
}

void func(){

	for(int row = 0; row < H; row++){

		scanf("%s",base_map[row]);
		for(int col = 0; col < W; col++){
			if(base_map[row][col] == 'K'){

				start.set(row,col);
				base_map[row][col] = '.';

			}else if(base_map[row][col] == 'M'){

				goal.set(row,col);
				base_map[row][col] = '.';
			}
		}
	}

	for(int row = 0; row < H; row++){
		for(int col = 0; col < W; col++){
			for(int a = 0; a < 4; a++){
				first_check[row][col][a] = false;
			}
		}
	}

	Info tmp;
	int adj_row,adj_col;
	queue<Info> first_Q;

	for(int i = 0; i < 4; i++){

		adj_row = start.row+diff_row[i];
		adj_col = start.col+diff_col[i];

		if(base_map[adj_row][adj_col] != '.')continue;

		tmp = get_next_state(start.row,start.col,dir_array[i]);
		first_check[tmp.row][tmp.col][tmp.dir] = true;
		first_Q.push(Info(tmp.row,tmp.col,tmp.dir));
	}

	bool FLG = false;
	DIR next_dir;

	while(!first_Q.empty()){

		if(first_Q.front().row == goal.row && first_Q.front().col == goal.col){
			FLG = true;
			break;
		}

		next_dir = get_Left(first_Q.front().dir);
		tmp = get_next_state(first_Q.front().row,first_Q.front().col,next_dir);
		if(!first_check[tmp.row][tmp.col][tmp.dir]){
			first_check[tmp.row][tmp.col][tmp.dir] = true;
			first_Q.push(Info(tmp.row,tmp.col,tmp.dir));
		}

		next_dir = get_Right(first_Q.front().dir);
		tmp = get_next_state(first_Q.front().row,first_Q.front().col,next_dir);
		if(!first_check[tmp.row][tmp.col][tmp.dir]){
			first_check[tmp.row][tmp.col][tmp.dir] = true;
			first_Q.push(Info(tmp.row,tmp.col,tmp.dir));
		}

		first_Q.pop();
	}

	if(!FLG){
		printf("He cannot bring tea to his master.\n");
		return;
	}

	DIR first_dir;
	for(int i = 0; i < 4; i++){

		adj_row = goal.row+diff_row[i];
		adj_col = goal.col+diff_col[i];
		if(base_map[adj_row][adj_col] == '.'){
			first_dir = dir_array[i];
			break;
		}
	}

	for(int row = 0; row < H; row++){
		for(int col = 0; col < W; col++){
			for(int a = 0; a < 4; a++){
				L_ORIGIN[row][col][a].clear();
				R_ORIGIN[row][col][a].clear();
			}
		}
	}

	for(int row = 0; row < H; row++){
		for(int col = 0; col < W; col++){
			if(base_map[row][col] != '.')continue;
			for(int a = 0; a < 4; a++){

				next_dir = get_Left(dir_array[a]);
				tmp = get_next_state(row,col,next_dir);
				L_ORIGIN[tmp.row][tmp.col][tmp.dir].push_back(Info(row,col,dir_array[a]));

				next_dir = get_Right(dir_array[a]);
				tmp = get_next_state(row,col,next_dir);
				R_ORIGIN[tmp.row][tmp.col][tmp.dir].push_back(Info(row,col,dir_array[a]));
			}
		}
	}

	for(int a = 0; a < H; a++){
		for(int b = 0; b < W; b++){
			for(int c = 0; c < 4; c++){
				for(int d = 0; d < H; d++){
					for(int e = 0; e < W; e++){
						for(int f = 0; f < 4; f++){
							check[a][b][c][d][e][f] = false;
						}
					}
				}
			}
		}
	}

	queue<Data> Q;
	Info go_tmp,return_tmp;

	for(int i = 0; i < 4; i++){

		adj_row = start.row+diff_row[i];
		adj_col = start.col+diff_col[i];
		if(base_map[adj_row][adj_col] != '.')continue;

		go_tmp = get_next_state(start.row,start.col,dir_array[i]);

		for(int k = 0; k < 4; k++){
			if(k == i)continue;

			check[go_tmp.row][go_tmp.col][go_tmp.dir][start.row][start.col][dir_array[k]] = true;
			Q.push(Data(go_tmp.row,go_tmp.col,go_tmp.dir,start.row,start.col,dir_array[k]));
		}
	}

	FLG = false;

	while(!Q.empty()){

		if(Q.front().go_row == goal.row && Q.front().go_col == goal.col){

			tmp = get_next_state(goal.row,goal.col,first_dir);

			if(Q.front().return_row == tmp.row && Q.front().return_col == tmp.col && Q.front().return_dir == tmp.dir){
				FLG = true;
				break;
			}
		}

		next_dir = get_Left(Q.front().go_dir);
		go_tmp = get_next_state(Q.front().go_row,Q.front().go_col,next_dir);

		for(int i = 0; i < R_ORIGIN[Q.front().return_row][Q.front().return_col][Q.front().return_dir].size(); i++){

			return_tmp = R_ORIGIN[Q.front().return_row][Q.front().return_col][Q.front().return_dir][i];

			if(!check[go_tmp.row][go_tmp.col][go_tmp.dir][return_tmp.row][return_tmp.col][return_tmp.dir]){

				check[go_tmp.row][go_tmp.col][go_tmp.dir][return_tmp.row][return_tmp.col][return_tmp.dir] = true;
				Q.push(Data(go_tmp.row,go_tmp.col,go_tmp.dir,return_tmp.row,return_tmp.col,return_tmp.dir));
			}
		}

		next_dir = get_Right(Q.front().go_dir);
		go_tmp = get_next_state(Q.front().go_row,Q.front().go_col,next_dir);

		for(int i = 0; i < L_ORIGIN[Q.front().return_row][Q.front().return_col][Q.front().return_dir].size(); i++){

			return_tmp = L_ORIGIN[Q.front().return_row][Q.front().return_col][Q.front().return_dir][i];

			if(!check[go_tmp.row][go_tmp.col][go_tmp.dir][return_tmp.row][return_tmp.col][return_tmp.dir]){

				check[go_tmp.row][go_tmp.col][go_tmp.dir][return_tmp.row][return_tmp.col][return_tmp.dir] = true;
				Q.push(Data(go_tmp.row,go_tmp.col,go_tmp.dir,return_tmp.row,return_tmp.col,return_tmp.dir));
			}
		}

		Q.pop();
	}

	if(FLG){
		printf("He can accomplish his mission.\n");
	}else{
		printf("He cannot return to the kitchen.\n");
	}
}

int main(){

	while(true){
		scanf("%d %d",&W,&H);
		if(W == 0 && H == 0)break;

		func();
	}

	return 0;
}



Measured memory_bytes: 20608