#include<bits/stdc++.h>
#define inf 1<<29
#define linf (1e16)
#define eps (1e-8)
#define Eps (1e-12)
#define mod 1000000007
#define pi acos(-1.0)
#define phi (1.0+sqrt(5.0))/2.0
#define f first
#define s second
#define mp make_pair
#define pb push_back
#define all(a) (a).begin(),(a).end()
#define pd(a) printf("%.10f\n",(double)(a))
#define pld(a) printf("%.10Lf\n",(ld)(a))
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i=(a)-1;(b)<=i;i--)
#define Unique(v) v.erase(unique(all(v)),v.end())
#define equals(a,b) (fabs((a)-(b))<eps)
using namespace std;
typedef long double ld;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<int,double> pid;
typedef pair<double,int> pdi;
typedef pair<double,double> pdd;
typedef vector<int> vi;
typedef vector<pii> vpi;
int dx[4] = {0,1,0,-1};
int dy[4] = {1,0,-1,0};
#define track() cout<<"######"<<endl;

int h,w;
string grid[16];
bool used[16][64][4][16][64][4];
bool flag1,flag2;
int sy,sx,sd,ty,tx,td;

int up(int d){return ((d+0)%4);}
int left(int d){return ((d+1)%4);}
int down(int d){return ((d+2)%4);}
int right(int d){return ((d+3)%4);}

vector<pair<pii,pii> > steps;

void rec(int ky,int kx,int kd,int my,int mx,int md){

  if(used[ky][kx][kd][my][mx][md])return;
  used[ky][kx][kd][my][mx][md] = true;

  int nky=ky,nkx=kx;
  while(1){
    if(grid[nky+dy[kd]][nkx+dx[kd]]=='#')break;
    nky = nky + dy[kd];
    nkx = nkx + dx[kd];
  }
  if(my==0){
    if(nky==ty && nkx==tx)flag1=true;
    rec(nky,nkx,left(kd),0,0,0);
    rec(nky,nkx,right(kd),0,0,0);
    return;
  }

  int nmy=my,nmx=mx; 
  while(1){
    if(grid[nmy+dy[ left(md)  ]][nmx+dx[ left(md)  ]]=='#' &&
       grid[nmy+dy[ right(md) ]][nmx+dx[ right(md) ]]=='.' ){
      rec(nky,nkx,right(kd),nmy,nmx,right(md));
    }
    if(grid[nmy+dy[ right(md) ]][nmx+dx[ right(md) ]]=='#' &&
       grid[nmy+dy[ left(md)  ]][nmx+dx[ left(md)  ]]=='.' ){
      rec(nky,nkx,left(kd),nmy,nmx,left(md));
    }  

    if(grid[nmy+dy[ down(md) ]][nmx+dx[ down(md) ]]=='#'){ 
      if(grid[nmy+dy[ right(md) ]][nmx+dx[ right(md) ]]=='#' &&
         grid[nmy+dy[ left(md)  ]][nmx+dx[ left(md)  ]]=='#' ){
        rec(nky,nkx,right(kd),nmy,nmx,right(md));
        rec(nky,nkx,left(kd),nmy,nmx,left(md));
      }
    }
    
    if(grid[nmy+dy[ md ]][nmx+dx[ md ]]=='#'){ 
      if(grid[nmy+dy[ right(md) ]][nmx+dx[ right(md) ]]=='#' &&
         grid[nmy+dy[ left(md)  ]][nmx+dx[ left(md)  ]]=='#' ){
        rec(nky,nkx,right(kd),nmy,nmx,right(md));
        rec(nky,nkx,left(kd),nmy,nmx,left(md));
      }
      break;
    }
    nmy = nmy + dy[md];
    nmx = nmx + dx[md];
  }
  if(nky==ty && nkx==tx && nmy==ty && nmx==tx && md==(td+2)%4)flag2 = true;
}

string solve(){
  memset(used,0,sizeof(used));
  flag1 = false;
  flag2 = false;
  FOR(i,0,h){
    FOR(j,0,w){
      if(grid[i][j]=='K'){
        sy = i;
        sx = j;
        grid[i][j]='.';
        FOR(k,0,4)
          if(grid[sy+dy[k]][sx+dx[k]]=='.')sd = k;
      }
      if(grid[i][j]=='M'){
        ty = i;
        tx = j;
        grid[i][j]='.';
        FOR(k,0,4)
          if(grid[ty+dy[k]][tx+dx[k]]=='.')td = k;
      }
    }
  }
  FOR(i,0,4)rec(sy,sx,sd,sy,sx,i);
  if(flag2)return "He can accomplish his mission.";
  rec(sy,sx,sd,0,0,0);
  if(flag1)return "He cannot return to the kitchen.";
  return "He cannot bring tea to his master.";
}

int main()
{
  while(cin>>w>>h && w){
    FOR(i,0,h)cin>>grid[i];
    cout<<solve()<<endl;
  }
  return 0;
}


Measured memory_bytes: 20460