#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <utility>
#include <queue>
#include <set>
#include <map>

using namespace std;
typedef  long long ll;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
#define  MP make_pair
#define  PB push_back
#define inf  1000000007
#define rep(i,n) for(int i=0;i<(int)(n);++i)

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

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

bool b[70][20];
bool a[70][20][4][70][20][4];
int x[70][20][4];
int y[70][20][4];
int w,h;

void init(vector<string> &v){
	for(int i=1;i<w-1;i++){
		for(int j=1;j<h-1;j++){
			if(v[j][i]=='#')continue;
			rep(k,4){
				int p = i;
				int q = j;
				while(1){
					if(v[q+dy[k]][p+dx[k]]=='#'){
						x[i][j][k] = p;
						y[i][j][k] = q;
						break;
					}else{
						q += dy[k];
						p += dx[k];
					}
				}
			}
		}
	}


}


int main(){
	while(cin >> w >> h &&w!=0){
		vector<string> v(h);
		Fill(a,false);
		Fill(x,-1);
		Fill(y,-1);
		rep(i,h){
			cin >> v[i];
		}
		init(v);
		pair<int,int> s,t;
		rep(i,h){
			rep(j,w){
				if(v[i][j]=='K'){
					s = MP(j,i);
					v[i][j]='.';
				}
				if(v[i][j]=='M'){
					t = MP(j,i);
					v[i][j] = '.';
				}
			}
		}
		int c,d;
		for(int i=0;i<4;i++){
			if(v[s.second+dy[i]][s.first+dx[i]]!='#'){
				c = i;
			}
		}
		for(int i=0;i<4;i++){
			if(v[t.second+dy[i]][t.first+dx[i]]!='#'){
				d = i;
			}
		}
		queue<pair<pair<int,pair<int,int> >,pair<int,pair<int,int> > > > q;
		pair<int,pair<int,int> > ss,tt;
		ss = MP(c,s);
		tt = MP(0,s);
		q.push(MP(ss,tt));
		tt = MP(1,s);
		q.push(MP(ss,tt));
		tt = MP(2,s);
		q.push(MP(ss,tt));
		tt = MP(3,s);
		q.push(MP(ss,tt));
		bool flag1=false,flag2=false;
		while(!q.empty()){
			pair<pair<int,pair<int,int> >,pair<int,pair<int,int> > > p;
			p = q.front();
			q.pop();
			int c1,x1,y1,c2,x2,y2;
			c1 = p.first.first;
			x1 = p.first.second.first;
			y1 = p.first.second.second;
			c2 = p.second.first;
			x2 = p.second.second.first;
			y2 = p.second.second.second;
			a[x1][y1][c1][x2][y2][c2] = true;
			//cout << x1 << " " << y1 << endl;
			if(p.first.second==t){
				flag1 = true;
			}
			int xx1,yy1,xx2,yy2;
			xx1 = x[x1][y1][c1];
			yy1 = y[x1][y1][c1];
			yy2 = y2;
			xx2 = x2;
			while(1){
				if(MP(xx2,yy2)==t&&d==c2&&MP(xx1,yy1)==t){
					flag2 = true;
					break;
				}
				for(int i=1;i<4;i++){
					if(i==2)continue;
					if(v[yy2+dy[(c2+i)%4]][xx2+dx[(c2+i)%4]]=='#'){
						if(a[xx1][yy1][(c1+i)%4][xx2][yy2][(c2+i)%4]==false){
							//cout << xx1 << " " << yy1 << " " << c1+i << " " << xx2 << " " << yy2 << " " << c2+i << endl;
							q.push(MP(MP((c1+i)%4,MP(xx1,yy1)),MP((c2+i)%4,MP(xx2,yy2))));
						}
					}
				}
				if(v[yy2-dy[c2]][xx2-dx[c2]]=='#')break;
				yy2 -=dy[c2];
				xx2 -=dx[c2];
			}
			if(flag2)break;
		}
		queue<pair<int,int> > q2;
		q2.push(s);
		Fill(b,false);
		while(!q2.empty()){
			pair<int,int> p2;
			p2 = q2.front();
			q2.pop();
			b[p2.first][p2.second]=true;
			if(p2==t){
				flag1 = true;
				break;
			}
			for(int i=0;i<4;i++){
				if(b[x[p2.first][p2.second][i]][y[p2.first][p2.second][i]]==false){
					q2.push(MP(x[p2.first][p2.second][i],y[p2.first][p2.second][i]));
				}
			}
		}
		if(flag2){
			cout << "He can accomplish his mission." << endl;
		}else if(flag1){
			cout << "He cannot return to the kitchen." << endl;
		}else{
			cout << "He cannot bring tea to his master." << endl;
		}
	}


	return 0;
}