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

int W,H;
char fie[80][20];

struct state {
  int px,py,pd,pm,pid;
  state(){}
  state(int px,int py,int pd,int pm=0,int pid=0)
    : px(px), py(py), pd(pd), pm(pm), pid(pid) {}
};

bool F[80][20][4];
vector<state> rev[64*16*4];
bool dp[64*16*4+1][64][16][4];

state nex[80][20][4];

// { up, right, down, left };
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};

void init(){
  fill(F[0][0],F[W][0],0 );
  for(int i=0;i<H*W*4;i++)
    rev[i].clear();
  fill( dp[0][0][0], dp[H*W*4][0][0], 0 );  
}

int getid(int x,int y,int d){
  return x + W * y + W * H * d;
}

void setnex(int x,int y,int d){
  if( fie[x][y] == '#' ) return;
  int px = x, py = y;
  int nx = x + dx[d], ny = y + dy[d];
  while( 0 <= nx && nx <= W &&
         0 <= ny && ny <= H &&
        fie[nx][ny] != '#' ) {
    x = nx, y = ny;
    nx += dx[d], ny += dy[d];
  }
  nex[px][py][d] = state( x, y, d );
}


bool bfs(int sx,int sy,int sd) {
  queue<state> q;
  q.emplace( sx, sy, sd );
  F[sx][sy][sd] = true;
  // cout << sx << " " << sy<< " " << sd << endl;
  bool ok = false;
  while( !q.empty() ) {
    state p = q.front(); q.pop();
    if( fie[p.px][p.py] == 'M' ) ok = true;
    for(int m=-1;m<=1;m+=2){
      int nd = (p.pd+m+4)%4;
      state ns = nex[p.px][p.py][nd];
      rev[ getid( ns.px, ns.py, ns.pd ) ]
        .emplace_back( p.px, p.py, p.pd, m, getid( p.px, p.py, p.pd ) );
      if( F[ns.px][ns.py][ns.pd] ) continue;
      F[ns.px][ns.py][ns.pd] = true;
      
      q.emplace( ns.px, ns.py, ns.pd );
    }
  }
  return ok;
}

bool check(int ex,int ey,int ed,int eid, int sx,int sy, int sd ){
  queue<state> q;
  //cout << "check!" << endl;
  for(int i=0;i<4;i++){
    q.emplace( ex, ey, ed, 0, eid+i*W*H );
    dp[eid+i*W*H][ex][ey][ed] = true;
  }
  while( !q.empty() ) {
    state p = q.front(); q.pop();
    //cout << p.px << " " << p.py << " "<<p.pd << " " << p.pid << endl;
    if( p.pid == getid( sx, sy, sd ) &&
        fie[p.px][p.py] == 'K' ) return true;
        
    for( state nst : rev[p.pid] ) {
      int nd = ( p.pd - nst.pm + 4 ) % 4;
      state ns = nex[p.px][p.py][nd];
      if( dp[nst.pid][ns.px][ns.py][ns.pd] ) continue;
      dp[ nst.pid ][ ns.px ][ ns.py ][ ns.pd ] = true;
      q.emplace( ns.px, ns.py, ns.pd, 0, nst.pid );      
    }    
  }
  return false;
}

int main(){
  while( cin >> W >> H && (W||H) ) {
    init();
    for(int i=0;i<H;i++){
      for(int j=0;j<W;j++){
        cin >> fie[j][i];
      }
    }
    int sx,sy,sd,ex,ey,ed,eid;
    for(int i=0;i<H;i++){
      for(int j=0;j<W;j++){
        for(int d=0;d<4;d++){
          setnex( j, i, d );
          if( fie[j][i] == 'K' &&
              ( nex[j][i][d].px != j || nex[j][i][d].py != i ) ) {
            sx = nex[j][i][d].px;
            sy = nex[j][i][d].py;
            sd = d;
          }
          if( fie[j][i] == 'M' &&
              ( nex[j][i][d].px != j || nex[j][i][d].py != i ) ) {
            ex = nex[j][i][d].px;
            ey = nex[j][i][d].py;
            ed = d;
            eid = getid(j,i,0);
          }
        }
      }
    }
    //cout << "start" << endl;
    //cout << sx<< " " <<sy << " " << sd << endl;
    //cout<< ex << " " << ey << " " << ed << " " << eid << endl;
     

    if( bfs( sx, sy, sd ) ) {
      if( check( ex, ey, ed, eid, sx, sy, sd ) )
        cout << "He can accomplish his mission." << endl;
      else
        cout << "He cannot return to the kitchen." << endl;
    } else
      cout << "He cannot bring tea to his master." << endl;              
  } 
}

Measured memory_bytes: 19972