import std.algorithm;
import std.array;
import std.ascii;
import std.container;
import std.conv;
import std.math;
import std.numeric;
import std.range;
import std.stdio;
import std.string;
import std.typecons;
import core.stdc.string;
void log(A...)(A arg) { stderr.writeln(arg); }
int size(T)(in T s) { return cast(int)s.length; }

alias Point = ushort;
Point makePoint(uint y, uint x, uint dir) {
    return cast(Point)((y << 8) + (x << 2) + dir);
}
int y(Point p) { return p >> 8; }
int x(Point p) { return (p & ((-1) << 2) & ((1 << 8) - 1)) >> 2; }
int dir(Point p) { return p & 3; }
struct State { Point forward, back; }
int hash(Point a, Point b) { return (a << 12) | b; }
int hash(State s) { return hash(s.forward, s.back); }

const bufsize = 1<<24;

void main() {
    int W, H;
    string[] F;
    auto checked = new bool[bufsize];

    bool input() {
        readf("%d %d\n", &W, &H);
        if (W == 0 && H == 0) return false;
        F = new string[H];
        foreach (ref L; F) {
            L = readln.chomp;
        }
        return true;
    }

    const int[] dy = [-1, 0, 1, 0];
    const int[] dx = [0, 1, 0, -1];

    char opposite(char dir_char) {
        return dir_char == 'R' ? 'L' : 'R';
    }

    Point K, M;
    void find_KandM() {
        int ky, kx, kdir;
        int my, mx, mdir;
        foreach (int y; 0 .. H) {
            foreach (int x; 0 .. W) {
                if (F[y][x] == 'K') {
                    kx = x;
                    ky = y;
                }
                if (F[y][x] == 'M') {
                    mx = x;
                    my = y;
                }
            }
        }
        int find_empty_dir(int sy, int sx) {
            int sd = -1;
            foreach (int j; 0 .. 4) {
                int ny = sy + dy[j];
                int nx = sx + dx[j];
                if (F[ny][nx] == '.') {
                    sd = j;
                }
            }
            return sd;
        }
        kdir = find_empty_dir(ky, kx);
        mdir = find_empty_dir(my, mx);
        K = makePoint(ky, kx, kdir);
        M = makePoint(my, mx, mdir);
    }
    
    Point forward(in Point p) {
        int k = p.dir;
        int cy = p.y;
        int cx = p.x;
        while (true) {
            int ny = cy + dy[k];
            int nx = cx + dx[k];
            if (F[ny][nx] == '#') break;
            cy = ny;
            cx = nx;
        }
        return makePoint(cy, cx, k);
    }
    
    Point turn(in Point p, char dir_char) {
        int dir;
        if (dir_char == 'R') {
            dir = +1;
        } else if (dir_char == 'L') {
            dir = -1;
        } else {
            assert(false);
        }
        int k = (p.dir + dir + 4) % 4;
        return makePoint(p.y, p.x, k);
    }

    void solve() {
        find_KandM();

        {
            memset(checked.ptr, false, bool.sizeof * bufsize);
            DList!Point Q;
            Q.insert(K);
            while (! Q.empty) {
                auto c = Q.front; Q.removeFront;
                foreach (char dir_char; "LR") {
                    auto next = forward(turn(c, dir_char));
                    if (checked[next]) continue;
                    Q.insert(next);
                    checked[next] = true;
                    if (next.y == M.y && next.x == M.x) {
                        goto NEXT;
                    }
                }
            }
            writeln("He cannot bring tea to his master.");
            return;
NEXT:;
        }

        memset(checked.ptr, false, bool.sizeof * bufsize);
        Point[][Tuple!(Point, char)] reachable_to;
        {
            void find_reachable_from(in Point src, char dir_char) {
                reachable_to[tuple(forward(turn(src, dir_char)), dir_char)] ~= src;
            }
            foreach (y; 0 .. H) {
                foreach (x; 0 .. W) {
                    if (F[y][x] == '#') continue;
                    foreach (dir; 0 .. 4) {
                        foreach (char dir_char; "LR") {
                            auto src = makePoint(y, x, dir);
                            find_reachable_from(src, dir_char);
                        }
                    }
                }
            }
        }

        auto init = forward(K);
        DList!State Q;
        foreach (last_dir; 0 .. 4) {
            auto last = makePoint(K.y, K.x, last_dir);
            Q.insert(State(init, last));
            checked[hash(init, last)] = true;
        }

        auto m = forward(M);
        while (! Q.empty) {
            State s = Q.front; Q.removeFront;
            foreach (char dir_char; "LR") {
                auto turned = turn(s.forward, dir_char);
                //log("forward: ", s.forward, " -> ", forward(turned));
                auto nforward = forward(turned);
                //log("back: ", s.back, " <- ", find_reachable_to(s.back))
                auto backs = reachable_to.get(tuple(s.back, opposite(dir_char)), []);
                foreach (nback; backs) {
                    auto nstate = State(nforward, nback);
                    if (checked[ hash(nstate) ]) continue;
                    Q.insert(nstate);
                    checked[hash(nforward, nback)] = true;
                    if (nforward.y == M.y && nforward.x == M.x && nback == m) {
                        writeln("He can accomplish his mission.");
                        return;
                    }
                }
            }
        }

        writeln("He cannot return to the kitchen.");
    }

    while (input()) solve();
}

Measured memory_bytes: 27240