#include <bits/stdc++.h>
using namespace std;

#define for_(i,a,b) for(int i=(a);i<(b);++i)
typedef pair< int, int > pii;

// L,U,R,D --- right:+1, left:-1
const int dx[4] = {-1,0,1,0};
const int dy[4] = {0,1,0,-1};
const int dc[2] = {-1,1};

int changeDirection(int f, int c) { return (f + dc[c] + 4) % 4; }

int W, H, pos_id[16][64];
string home_map[16];

int nextPos(int cx, int cy, int d) {
	while (home_map[cy + dy[d]][cx + dx[d]] != '#') {
		cx += dx[d];
		cy += dy[d];
	}
	return pos_id[cy][cx];
}

/***************** solver ********************/

int trans[1024][4][2];
vector< int > trans_rev[1024][4][2];
int start_id, start_dir, goal_id, goal_dir;
vector< int > wall_dir_at_M, wall_dir_at_K;

void constructTransition() {
	memset(trans, -1, sizeof(trans));
	for_(i,0,1024) for_(j,0,4) for_(k,0,2) trans_rev[i][j][k] = vector< int >();
	wall_dir_at_M = wall_dir_at_K = vector< int >();
		
	int id = 1;
	for_(y,0,H) for_(x,0,W) {
		if (home_map[y][x] == 'K') pos_id[y][x] = 0;
		if (home_map[y][x] == 'M') pos_id[y][x] = 1023;
		if (home_map[y][x] == '.') pos_id[y][x] = id++;
	}
	
	int cnt = 0;
	for_(y,0,H) {
		for_(x,0,W) {
			if (home_map[y][x] == 'M' || home_map[y][x] == 'K') {
				for_(d,0,4) {
					int nx = x + dx[d], ny = y + dy[d];
					if (home_map[ny][nx] == '#') {
						if (home_map[y][x] == 'M') wall_dir_at_M.push_back(d);
						if (home_map[y][x] == 'K') wall_dir_at_K.push_back(d);
						continue;
					}
				
					if (home_map[y][x] == 'M') {
						goal_id = nextPos(nx, ny, d);
						goal_dir = d;
					} else {
						start_id = nextPos(nx, ny, d);
						start_dir = d;
					}
				}
				++cnt;
			}
			if (cnt == 2) break;
		}
		if (cnt == 2) break;
	}
	
	for_(y,0,H) for_(x,0,W) {
		if (home_map[y][x] == '#') continue;
		id = pos_id[y][x];
		for_(f,0,4) for_(c,0,2) {
			int nxt_dir = changeDirection(f, c);
			int nxt_id = nextPos(x, y, nxt_dir);
			trans[id][f][c] = nxt_id;
			trans_rev[nxt_id][nxt_dir][c].push_back(id);
		}
	}
}

struct State {
	int id, dir;
	int rev_id, rev_dir;
};

bool visM[1024][4];
bool vis[1024][4][1024][4];

bool canReachMaster() {
	memset(visM, 0, sizeof(visM));
	
	queue< pii > que;
	que.push(pii(start_id, start_dir));
	visM[start_id][start_dir] = true;
	
	while (!que.empty()) {
		pii p = que.front(); que.pop();
		if (p.first == 1023) return true;
		for_(c,0,2) {
			int nxt_id = trans[p.first][p.second][c], nxt_dir = changeDirection(p.second, c);
			if (!visM[nxt_id][nxt_dir]) {
				visM[nxt_id][nxt_dir] = true;
				que.push(pii(nxt_id, nxt_dir));
			}
		}
	}
	
	return false;
}

bool canDo() {
	memset(vis, 0, sizeof(vis));
	
	queue< State > que;
	for (int d : wall_dir_at_K) {
		que.push(State{start_id, start_dir, 0, d});
		vis[start_id][start_dir][0][d] = true;
	}
	
	while (!que.empty()) {
		State s = que.front(); que.pop();
		if (s.id == 1023 && s.rev_id == goal_id && s.rev_dir == goal_dir) return true;
		for_(c,0,2) {
			int nxt_id = trans[s.id][s.dir][c], nxt_dir = changeDirection(s.dir, c), nxt_rev_dir = changeDirection(s.rev_dir, c);
			for (int nxt_rev_id : trans_rev[s.rev_id][s.rev_dir][1 - c]) {
				if (!vis[nxt_id][nxt_dir][nxt_rev_id][nxt_rev_dir]) {
					vis[nxt_id][nxt_dir][nxt_rev_id][nxt_rev_dir] = true;
					que.push(State{nxt_id, nxt_dir, nxt_rev_id, nxt_rev_dir});
				}
			}
		}
	}
	
	return false;
}

void solve() {
	constructTransition();	
	if (canReachMaster()) {
		if (canDo()) puts("He can accomplish his mission.");
		else puts("He cannot return to the kitchen.");
	} else {
		puts("He cannot bring tea to his master.");
	}
}

int main() {
	while (1) {
		cin >> W >> H;
		if (H == 0) break;
		for_(y,0,H) cin >> home_map[y];
		solve();
	}
}