#include <iostream>
#include <bits/stdc++.h>
#define maxn 11
using namespace std;
struct Node
{
int r,c,dir;
Node(int r1,int c1,int dir1):r(r1),c(c1),dir(dir1){}
Node(){}
};
int r0,c0,dir0,r1,c1,r2,c2;
char* dirs = "NESW";
char* turns = "FLR";
const int dr[]={-1, 0, 1, 0};
const int dc[]={ 0, 1, 0, -1};
int has_edge[maxn][maxn][4][3];
Node p[maxn][maxn][4];
int d[maxn][maxn][4];
int dir_id(char c)
{
return strchr(dirs,c)-dirs;
}
int turn_id(char c)
{
return strchr(turns,c)-turns;
}
Node walk(const Node& u,int turn)
{
int dir = u.dir;
if(turn == 1) dir = (dir+3)%4;
if(turn == 2) dir = (dir+1)%4;
return Node(u.r+dr[dir],u.c+dc[dir],dir);
}
void print(Node u)
{
vector<Node>nodes;
for(;;)
{
nodes.push_back(u);
if(d[u.r][u.c][u.dir]==0) break;
u=p[u.r][u.c][u.dir];
}
//打印解
int cnt=0;
for(int i=nodes.size()-1;i>=0;i--)
{
if(cnt%10==0) printf(" ");
printf(" (%d,%d)",nodes[i].r,nodes[i].c);
if(++cnt%10==0) printf("\n");
}
if(nodes.size()%10!=0) printf("\n");
}
void bfs()
{
queue<Node>q;
d[r0][c0][dir0] = 0;
d[r1][c1][dir0] = 1;
p[r1][c1][dir0] = Node(r0,c0,dir0);
Node v = Node(r1,c1,dir0);
q.push(v);
while(!q.empty())
{
Node u = q.front();
q.pop();
//cout<<u.r<<" "<<u.c<<endl;
if(u.r == r2&&u.c==c2)
{
print(u);
return;
}
for(int i = 0;i<3;i++)
{
if(has_edge[u.r][u.c][u.dir][i])
{
v = walk(u,i);
if(d[v.r][v.c][v.dir]<0)
{
d[v.r][v.c][v.dir] = d[u.r][u.c][u.dir]+1;
p[v.r][v.c][v.dir] = u;
q.push(v);
}
}
}
}
cout<<" No Solution Possible"<<endl;
}
int main()
{
string name,t,s;
char a;
int r,c,dir,turn;
while(cin>>name&&name!="END")
{
memset(has_edge,0,sizeof(has_edge));
memset(p,0,sizeof(p));
memset(d,-1,sizeof(d));
cin>>r0>>c0>>a>>r2>>c2;
dir0 = dir_id(a);
r1 = r0+dr[dir0];
c1 = c0+dc[dir0];
getchar();
while(getline(cin,s)&&s!="0")
{
stringstream ss(s);
ss>>r>>c;
while(ss>>t&&t!="*")
{
dir = dir_id(t[0]);
for(int i = 1;i<t.size();i++)
{
turn = turn_id(t[i]);
has_edge[r][c][dir][turn] =1;
}
}
}
cout<<name<<"\n";
bfs();
}
return 0;
}
/**
SAMPLE
3 1 N 3 3
1 1 WL NR *
1 2 WLF NR ER *
1 3 NL ER *
2 1 SL WR NF *
2 2 SL WF ELF *
2 3 SFR EL *
0
NOSOLUTION
3 1 N 3 2
1 1 WL NR *
1 2 NL ER *
2 1 SL WR NFR *
2 2 SR EL *
0
END
**/