#include <iostream>
#include <queue>
#include <cstring>
#include <algorithm>
#define MAXN 21
using namespace std;
char map[MAXN][MAXN];
bool visited[MAXN][MAXN][MAXN][MAXN];
int N,M;
int tx,ty,sx,sy,bx,by;
int dx[] = {0,1,0,-1};
int dy[] = {1,0,-1,0};
struct node{
    int x1,y1,x2,y2;
    int cnt1,cnt2;
    string path;
    bool operator < (const node& a) const{
        if (a.cnt2 == cnt2) return a.cnt1+a.cnt2 < cnt1+cnt2;
        return a.cnt2 < cnt2;
    }
};
priority_queue<node> q;
string dirs = "eswnESWN";
bool is_range(int x, int y){
    return (x>=0 && y >= 0 && x < N && y <M);
}
string bfs(){
    q.push({sx,sy,bx,by,0,0,""});
    visited[sx][sy][bx][by] = true;
    while(!q.empty()){
        int x1 = q.top().x1;
        int y1 = q.top().y1;
        int x2 = q.top().x2;
        int y2 = q.top().y2;
        string cur_path = q.top().path;
        int cnt1 = q.top().cnt1;
        int cnt2 = q.top().cnt2;
        if (x2 == tx && y2 == ty) {
            return cur_path;
        }
        q.pop();
        for (int k =0 ;k<4; k++){
            int nx1 = x1 + dx[k];
            int ny1 = y1 + dy[k];
            if (!is_range(nx1,ny1) || map[nx1][ny1]=='#') continue;
            // 박스를 미는 경우
            if (nx1 == x2 && ny1 == y2){
                int nx2 = x2 + dx[k];
                int ny2 = y2 + dy[k];
                if (!is_range(nx2,ny2)) continue;
                if (map[nx2][ny2]=='#' || visited[nx1][ny1][nx2][ny2]) continue;
                visited[nx1][ny1][nx2][ny2] = true;
                q.push({nx1,ny1,nx2,ny2,cnt1,cnt2+1,cur_path+dirs[k+4]});
            }
            // 박스를 찾는 경우
            else{
                if(visited[nx1][ny1][x2][y2]) continue;
                visited[nx1][ny1][x2][y2] = true;
                q.push({nx1,ny1,x2,y2,cnt1+1,cnt2,cur_path+dirs[k]});
            }
        }
    }
    return "Impossible.";
}
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int t = 0;
    while (1){
        cin >> N >> M;
        if (N ==0  && M == 0) break;
        memset(visited,false,sizeof(visited));
        while (!q.empty()) q.pop();
        for (int i =0;i<N; i++){
            cin >> map[i];
            for (int j =0;j<M;j++){
                if (map[i][j] == 'S') {
                    sx=i,sy=j;
                    map[i][j] = '.';
                }
                else if (map[i][j] == 'B'){
                    bx = i, by = j;
                    map[i][j] = '.';
                }
                else if (map[i][j] == 'T'){
                    tx = i , ty = j;
                    map[i][j] = '.';
                }
            }
        }
        cout <<"Maze #"<< ++t <<"\n";
        cout << bfs() <<"\n\n";
    }
    return 0;
}