#include <algorithm>
#include <cmath>
#include <climits>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <fstream>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <cassert>
#include <functional>

using namespace std;

#define LOG(...) printf(__VA_ARGS__)
//#define LOG(...)
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define RSORT(c) sort((c).rbegin(),(c).rend())
#define CLR(a) memset((a), 0 ,sizeof(a))

typedef long long ll;
typedef unsigned long long ull;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vb> vvb;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

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

struct pos{
	int x1;
	int y1;
	int d1;
	int x2;
	int y2;
	int d2;
};

struct pos2{
	int x1;
	int y1;
	int d1;
};

bool operator <(const pos left, const pos right){
	return left.x1 == right.x1 ? left.y1 == right.y1 ? left.d1 == right.d1 ? left.x2 == right.x2 ? left.y2 == right.y2 ? left.d2 < right.d2 : left.y2 < right.y2 : left.x2 < right.x2 : left.d1 < right.d1 : left.y1 < right.y1 : left.x1 < right.x1;
}
bool operator <(const pos2 left, const pos2 right){
	return left.x1 == right.x1 ? left.y1 == right.y1 ? left.d1 < right.d1 : left.y1 < right.y1 : left.x1 < right.x1;
}

int main() {
	int w, h;
	while (cin >> w >> h, w){
		int sx, sy, gx, gy;
		vvb wall(h, vb(w, false));
		REP(i, h){
			string s;
			cin >> s;
			REP(j, w){
				if (s[j] == '#')
					wall[i][j] = true;
				if (s[j] == 'K'){
					sx = j;
					sy = i;
				}
				if (s[j] == 'M'){
					gx = j;
					gy = i;
				}
			}
		}

		int dirs, dirg;
		set<pos2> G2;
		queue<pos2> Q2;
		int ans = 0;
		REP(i, 4){
			if (wall[sy + dy[i]][sx + dx[i]] == false)
				dirs = i;
			if (wall[gy + dy[i]][gx + dx[i]] == false)
				dirg = i;
		}
		REP(i, 4){
			G2.insert({ sx, sy, dirs });
			Q2.push({ sx, sy, dirs });
		}

		while (!Q2.empty()){
			pos2 p = Q2.front(); Q2.pop();
			if (p.x1 == gx&&p.y1 == gy){
				ans = 1;
				break;
			}

			while (wall[p.y1 + dy[p.d1]][p.x1 + dx[p.d1]] != true){
				p.x1 += dx[p.d1];
				p.y1 += dy[p.d1];
			}

			if (G2.find({ p.x1, p.y1, (p.d1 + 1) % 4}) == G2.end()){
				G2.insert({ p.x1, p.y1, (p.d1 + 1) % 4});
				Q2.push({ p.x1, p.y1, (p.d1 + 1) % 4});
			}
			if (G2.find({ p.x1, p.y1, (p.d1 + 3) % 4}) == G2.end()){
				G2.insert({ p.x1, p.y1, (p.d1 + 3) % 4});
				Q2.push({ p.x1, p.y1, (p.d1 + 3) % 4});
			}
		}

		set<pos> G;
		queue<pos> Q;

		REP(i, 4){
			G.insert({ sx, sy, dirs, sx, sy, i });
			Q.push({ sx, sy, dirs, sx, sy, i });
		}


		while (!Q.empty()){
			pos p = Q.front(); Q.pop();

			while (wall[p.y1 + dy[p.d1]][p.x1 + dx[p.d1]] != true){
				p.x1 += dx[p.d1];
				p.y1 += dy[p.d1];
			}

			while (true) {


				if (wall[p.y2 + dy[(p.d2 + 1) % 4]][p.x2 + dx[(p.d2 + 1) % 4]]){
					if (G.find({ p.x1, p.y1, (p.d1 + 1) % 4, p.x2, p.y2, (p.d2 + 1) % 4 }) == G.end()){
						G.insert({ p.x1, p.y1, (p.d1 + 1) % 4, p.x2, p.y2, (p.d2 + 1) % 4 });
						Q.push({ p.x1, p.y1, (p.d1 + 1) % 4, p.x2, p.y2, (p.d2 + 1) % 4 });
					}
				}
				if (wall[p.y2 + dy[(p.d2 + 3) % 4]][p.x2 + dx[(p.d2 + 3) % 4]]){
					if (G.find({ p.x1, p.y1, (p.d1 + 3) % 4, p.x2, p.y2, (p.d2 + 3) % 4 }) == G.end()){
						G.insert({ p.x1, p.y1, (p.d1 + 3) % 4, p.x2, p.y2, (p.d2 + 3) % 4 });
						Q.push({ p.x1, p.y1, (p.d1 + 3) % 4, p.x2, p.y2, (p.d2 + 3) % 4 });
					}
				}
				if (!wall[p.y2 + dy[(p.d2 + 2) % 4]][p.x2 + dx[(p.d2 + 2) % 4]]){
					p.x2 += dx[(p.d2 + 2) % 4];
					p.y2 += dy[(p.d2 + 2) % 4];
				}
				else{
					break;
				}
			}
			if (p.x1 == gx&&p.y1 == gy&&p.x2 == gx&&p.y2 == gy&&p.d2 == dirg){
				ans = 2;
				break;
			}
			if (ans == 2)
				break;
		}
		if (ans == 0)
			cout << "He cannot bring tea to his master." << endl;
		if (ans == 1)
			cout << "He cannot return to the kitchen." << endl;
		if (ans == 2)
			cout << "He can accomplish his mission." << endl;
	}
}

Measured memory_bytes: 18184