#include<bits/stdc++.h>
using namespace std;
using Int = long long;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}

//INSERT ABOVE HERE
const int D = 4,H = 16, W = 64;
bool dp[D][H][W][D][H][W];
char st[H][W];

bool rc[D][H][W];

using P = pair<int, int>;
using T = tuple<int, int, int>;
P mv[D][H][W];

struct ST{
  int k1,y1,x1,k2,y2,x2;
  ST(){}
  ST(int k1,int y1,int x1,int k2,int y2,int x2):
    k1(k1),y1(y1),x1(x1),k2(k2),y2(y2),x2(x2){}
};

signed main(){
  int w,h;
  while(cin>>w>>h,w){
    vector<string> tt(h);
    for(int i=0;i<h;i++) cin>>tt[i];
    memset(st,'#',sizeof(st));
    for(int i=0;i<h;i++)
      for(int j=0;j<w;j++)
        st[i][j]=tt[i][j];
    h=H;w=W;

    int sy=-1,sx=-1,gy=-1,gx=-1;
    for(int i=0;i<h;i++){
      for(int j=0;j<w;j++){
        if(st[i][j]=='K') sy=i,sx=j;
        if(st[i][j]=='M') gy=i,gx=j;
      }
    }

    int dy[]={0,1,0,-1};
    int dx[]={1,0,-1,0};
    for(int i=0;i<h;i++){
      for(int j=0;j<w;j++){
        if(st[i][j]=='#') continue;
        for(int k=0;k<4;k++){
          int y=i,x=j;
          while(st[y+dy[k]][x+dx[k]]!='#'){
            y+=dy[k];
            x+=dx[k];
          }
          mv[k][i][j]=P(y,x);
        }
      }
    }

    {
      memset(rc,0,sizeof(rc));
      queue<T> que;
      for(int k=0;k<4;k++){
        if(st[sy+dy[k]][sx+dx[k]]=='.'){
          int y,x;
          tie(y,x)=mv[k][sy][sx];
          rc[k][y][x]=1;
          que.emplace(k,y,x);
        }
      }

      while(!que.empty()){
        int k,y,x;
        tie(k,y,x)=que.front();que.pop();
        assert(st[y+dy[k]][x+dx[k]]=='#');
        for(int dk=1;dk<4;dk+=2){
          int nk=(k+dk)%4;
          int ny,nx;
          tie(ny,nx)=mv[nk][y][x];
          if(rc[nk][ny][nx]) continue;
          rc[nk][ny][nx]=1;
          que.emplace(nk,ny,nx);
        }
      }

      int flg=0;
      for(int k=0;k<4;k++)
        flg|=rc[k][gy][gx];
      if(!flg){
        cout<<"He cannot bring tea to his master."<<endl;
        continue;
      }
    }

    int tap=0,uku=0;
    for(int k=0;k<4;k++){
      if(st[sy+dy[k]][sx+dx[k]]=='.')
        tap=k;
      if(st[gy+dy[k]][gx+dx[k]]=='.')
        uku=k;
    }
    memset(dp,0,sizeof(dp));
    queue<ST> que;
    auto push=
      [&](int k1,int y1,int x1,int k2,int y2,int x2){
        if(dp[k1][y1][x1][k2][y2][x2]) return;
        dp[k1][y1][x1][k2][y2][x2]=1;
        que.emplace(k1,y1,x1,k2,y2,x2);
      };

    for(int k=0;k<4;k++){
      if(st[sy+dy[k]][sx+dx[k]]!='#') continue;
      push(tap,mv[tap][sy][sx].first,mv[tap][sy][sx].second,k,sy,sx);
    }

    while(!que.empty()){
      ST s=que.front();que.pop();
      assert(st[s.y1][s.x1]!='#');
      assert(st[s.y2][s.x2]!='#');
      assert(st[s.y1+dy[s.k1]][s.x1+dx[s.k1]]=='#');
      assert(st[s.y2+dy[s.k2]][s.x2+dx[s.k2]]=='#');

      for(int dk=1;dk<4;dk+=2){
        int nk1=(s.k1+dk)%4;
        int ny1,nx1;
        tie(ny1,nx1)=mv[nk1][s.y1][s.x1];

        int nk2=(s.k2+dk)%4;
        int ny2=s.y2,nx2=s.x2;
        while(st[ny2][nx2]!='#'){
          if(st[ny2+dy[nk2]][nx2+dx[nk2]]=='#')
            push(nk1,ny1,nx1,nk2,ny2,nx2);
          ny2-=dy[s.k2];
          nx2-=dx[s.k2];
        }
      }
    }

    int flg=0;
    for(int k=0;k<4;k++)
      flg|=dp[k][gy][gx][uku][mv[uku][gy][gx].first][mv[uku][gy][gx].second];
    if(flg) cout<<"He can accomplish his mission."<<endl;
    else cout<<"He cannot return to the kitchen."<<endl;
  }
  return 0;
}



Measured memory_bytes: 19768