#include<iostream>
#include<stack>
#include<vector>
#include<algorithm>
#include<cstring>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;

typedef vector<int> pos;
typedef pair<int,int> P;

int w,h;
string g[16];
int dy[] = {-1,0,1,0}, dx[] = {0,1,0,-1};
bool vis[16][64][4][16][64][4];

int main(){
  int cnt=0;
  while(cin >> w >> h,w){
    cnt++;
    rep(i,h)cin >> g[i];
    memset(vis,0,sizeof(vis));

    int sy,sx,sd, gy,gx,gd;
    rep(i,h){
      rep(j,w){
	if(g[i][j] == 'K'){
	  rep(k,4){
	    int ny = i+dy[k], nx = j+dx[k];
	    if(ny<0 || nx<0 || ny>=h || nx>=w)continue;
	    if(g[ny][nx] == '.'){
	      sy = i; sx = j; sd = k;
	    }
	  }
	}
	if(g[i][j] == 'M'){
	  rep(k,4){
	    int ny = i+dy[k], nx = j+dx[k];
	    if(ny<0 || nx<0 || ny>=h || nx>=w)continue;
	    if(g[ny][nx] == '.'){
	      gy = i; gx = j; gd = k;
	    }
	  }
	}
      }
    }

    stack<pos> s;
    pos p(6);
    p[0] = sy; p[1] = sx; p[2] = sd;
    p[3] = sy; p[4] = sx;

    rep(i,4){
      vis[sy][sx][sd][sy][sx][i] = true;
      p[5] = i;
      s.push(p);
    }

    while(s.size()){
      p = s.top(); s.pop();

      int d1 = p[2], y1 = p[0]+dy[d1], x1 = p[1]+dx[d1];
      while(g[y1][x1]!='#'){
	y1+=dy[d1]; x1+=dx[d1];
      }
      y1-=dy[d1]; x1-=dx[d1];

      int d2 = p[5], y2 = p[3], x2 = p[4];
      while(g[y2][x2]!='#'){
	int rd = (p[5]+1)%4, ry = y2+dy[rd], rx = x2+dx[rd];
	int ld = (p[5]+3)%4, ly = y2+dy[ld], lx = x2+dx[ld];

	if(g[ry][rx]=='#' || g[ly][lx]=='#'){
	  if(!vis[y1][x1][d1][y2][x2][d2]){
	    vis[y1][x1][d1][y2][x2][d2] = true;
	    if(g[ry][rx]=='#'){
	      pos tmp(6);
	      tmp[0] = y1; tmp[1] = x1; tmp[2] = (d1+1)%4;
	      tmp[3] = y2; tmp[4] = x2; tmp[5] = rd;
	      s.push(tmp);
	    }

	    if(g[ly][lx]=='#'){
	      pos tmp(6);
	      tmp[0] = y1; tmp[1] = x1; tmp[2] = (d1+3)%4;
	      tmp[3] = y2; tmp[4] = x2; tmp[5] = ld;
	      s.push(tmp);
	    }
	  }
	}
	y2-=dy[d2]; x2-=dx[d2];
      }
    }
    bool f1=false;
    rep(i,4){
      if(vis[gy][gx][i][gy][gx][gd])f1 = true;
    }

    if(f1)cout << "He can accomplish his mission." << endl;
    else{
      memset(vis,0,sizeof(vis));
      p.resize(3);
      p[0] = sy; p[1] = sx; p[2] = sd;
      s.push(p);

      while(s.size()){
	p = s.top(); s.pop();
	
	int ny = p[0]+dy[p[2]], nx = p[1]+dx[p[2]];
	while(g[ny][nx]!='#'){
	  ny += dy[p[2]]; nx += dx[p[2]];
	}
	ny -= dy[p[2]]; nx -= dx[p[2]];
	
	if(vis[ny][nx][p[2]][0][0][0])continue;
	vis[ny][nx][p[2]][0][0][0] = true;
	rep(d,2){
	  int nd = (p[2] + 2*d+1)%4;
	  pos tmp(3);
	  tmp[0] = ny; tmp[1] = nx; tmp[2] = nd;
	  s.push(tmp);
	}
      }	  
      
      bool f2=false;
      rep(i,4){
	if(vis[gy][gx][i][0][0][0])f2 = true;
      }
      if(f2)cout << "He cannot return to the kitchen." << endl;
      else cout << "He cannot bring tea to his master." << endl;
    }
  }
}