#include<iostream>
#include<vector>
using namespace std;
#define REP(i,b,n) for(int i=b;i<n;i++)
#define rep(i,n)   REP(i,0,n)
#define pb         push_back

const int R   = 16;
const int C   = 64;
const int DIR = 4;
bool vis[R][C][DIR][R][C][DIR]={false};
char m[R][C];

class Edge{
public:
  int y,x,d;
};

#define RIGHT 0
#define LEFT 1
//N E S W
int dx[]={0,1,0,-1};
int dy[]={-1,0,1,0};
int d[] ={1,3};


vector<Edge> edge[R][C][DIR][2];//0 right 1 left
vector<Edge>  rev[R][C][DIR][2];

void make_edge(int r,int c){
  REP(i,1,r-1){
    REP(j,1,c-1){
      if (m[i][j] == '#')continue;
      rep(k,4){
	if (m[i+dy[k]][j+dx[k]] != '#')continue;//no wall	
	rep(l,2){
	  int nex=j,ney=i;
	  int ndir=(k+d[l])%4;
	  while(true){
	    if (m[ney+dy[ndir]][nex+dx[ndir]] == '#')break;
	    ney+=dy[ndir];
	    nex+=dx[ndir];
	  }
	  edge[i][j][k][l].pb(      (Edge){ney,nex,ndir});
	  rev[ney][nex][ndir][l].pb((Edge){i  ,  j,   k});
	}
      }
    }
  }
}

bool cango;
bool solve(int r,int c,int sy,int sx,int sd,
	   int ry,int rx,int rd,
	   int gy,int gx,int gd){

  if (vis[sy][sx][sd][ry][rx][rd])return false;
  vis[sy][sx][sd][ry][rx][rd]=true;
  
  if (m[sy][sx] == 'M' &&
      ry == gy && rx == gx && rd == gd)return true;

  Edge cpy1,cpy2;

  rep(l,2){
     rep(i,edge[sy][sx][sd][l].size()){
      int rl=1-l;
      cpy1=edge[sy][sx][sd][l][i];
      rep(j,rev[ry][rx][rd][rl].size()){
	cpy2=rev[ry][rx][rd][rl][j];
	if (solve(r,c,cpy1.y,cpy1.x,cpy1.d,
		  cpy2.y,cpy2.x,cpy2.d,gy,gx,gd)){
	  return true;
	}
      }
    }
  }
  return false;
}


bool vis2[R][C][DIR];
bool solve_to_kit(int r,int c,int sy,int sx,int sd){
  if (vis2[sy][sx][sd])return false;

  vis2[sy][sx][sd]=true;
  if (m[sy][sx] == 'M')return true;
  
  Edge cpy1;
  rep(l,2){
     rep(i,edge[sy][sx][sd][l].size()){
      cpy1=edge[sy][sx][sd][l][i];
      if (solve_to_kit(r,c,cpy1.y,cpy1.x,cpy1.d))return true;
     }
  }
  return false;
}

main(){
  int r,c;
  while(cin>>c>>r && r){
    rep(i,r)rep(j,c)rep(k,4)rep(l,2)
      edge[i][j][k][l].clear(),rev[i][j][k][l].clear();
    rep(i,r)rep(j,c)rep(k,DIR)rep(ii,r)rep(jj,c)rep(kk,DIR)
      vis[i][j][k][ii][jj][kk] = false;
    rep(i,r)rep(j,c)rep(k,DIR)vis2[i][j][k]=false;
    cango=false;
    
    int inix,iniy,inidir,orix,oriy,goalx,goaly,goaldir;
    rep(i,r){
      rep(j,c){
	cin>>m[i][j];
	if (m[i][j] == 'K')inix =j,iniy =i;
	if (m[i][j] == 'M')goalx=j,goaly=i;
      }
    }

    orix=inix;
    oriy=iniy;
    rep(i,4){
      int nex=inix+dx[i],ney=iniy+dy[i];
      if(m[ney][nex] != '#'){
	inidir = i;
	break;
      }
    }
    
    while(m[iniy+dy[inidir]][inix+dx[inidir]] != '#'){
      inix+=dx[inidir];
      iniy+=dy[inidir];
    }

    rep(i,4){
      int nex = goalx+dx[i],ney=goaly+dy[i];
      if (m[ney][nex] != '#'){
	goaldir = i;
	break;
      }
    }

    while(m[goaly+dy[goaldir]][goalx+dx[goaldir]] != '#'){
      goalx+=dx[goaldir];
      goaly+=dy[goaldir];
    }

    make_edge(r,c);


    if (solve_to_kit(r,c,iniy,inix,inidir))cango=true;
    
    bool isok=false;
    rep(i,4){
      int checkx=orix+dx[i],checky=oriy+dy[i];
      if (m[checky][checkx] != '#')continue;
      if (solve(r,c,iniy,inix,inidir,oriy,orix,i,
		goaly,goalx,goaldir)){
	isok=true;
	break;
      }
    }


    if (isok)cout <<"He can accomplish his mission."<<endl;
    else if(cango)cout <<"He cannot return to the kitchen."<<endl;
    else cout << "He cannot bring tea to his master."<<endl;
  }
}

Measured memory_bytes: 0