#include<bits/stdc++.h>
using namespace std;

struct data{
    int pos,state,cost;
    data(int pos,int state):pos(pos),state(state){}
};
const int INF=1001001001;

int N,M;
vector<int>G[15];
vector<int>light[15];
int dist[1<<16][15];
int prevstate[1<<16][15],prevpos[1<<16][15];
void solve(int bit){
    fill_n(*dist,(1<<16)*15,INF);
    dist[bit][0]=0;
    queue<data>que;
    que.push(data(0,bit));

    while(que.size()){
        data d=que.front();que.pop();

        for(int i=0;i<light[d.pos].size();i++){
            int l=light[d.pos][i];
            if(l==d.pos)continue;
            int tobit=d.state^(1<<l);
            if(dist[tobit][d.pos]<=dist[d.state][d.pos]+1)continue;
            dist[tobit][d.pos]=dist[d.state][d.pos]+1;
            prevstate[tobit][d.pos]=d.state;
            prevpos[tobit][d.pos]=d.pos;
            que.push(data(d.pos,tobit));
        }

        for(int i=0;i<G[d.pos].size();i++){
            int to=G[d.pos][i];
            if((d.state>>to&1)==0)continue;
            if(dist[d.state][to]<=dist[d.state][d.pos]+1)continue;
            dist[d.state][to]=dist[d.state][d.pos]+1;
            prevstate[d.state][to]=d.state;
            prevpos[d.state][to]=d.pos;
            que.push(data(to,d.state));
        }
    }

    bool flag=false;
    for(int i=0;i<(1<<N);i++)if(dist[i][N-1]!=INF)flag=true;
    if(!flag){
        cout<<"Help me!"<<endl;
        return;
    }

    if(dist[1<<(N-1)][N-1]==INF){
        cout<<"You can not switch off all lights."<<endl;
        return;
    }

    int state=1<<(N-1),pos=N-1;
    cout<<"You can go home in "<<dist[1<<(N-1)][N-1]<<" steps."<<endl;
    vector<string>log;
    while(state!=bit||pos!=0){
        string s;
        if(prevpos[state][pos]!=pos){
            stringstream ss;
            ss<<"Move to room "<<pos+1<<".";
            getline(ss,s);
            log.push_back(s);
            int a=prevstate[state][pos];
            int b=prevpos[state][pos];
            state=a;pos=b;
        }
        else{
            vector<int>id;
            vector<int>is;
            while(prevstate[state][pos]!=state&&(state!=bit||pos!=0)){
                for(int i=0;i<N;i++){
                    if((prevstate[state][pos]>>i&1)!=(state>>i&1)){
                        id.push_back(i);
                        is.push_back(state>>i&1);
                        break;
                    }
                }
                int a=prevstate[state][pos];
                int b=prevpos[state][pos];
                state=a;pos=b;
            }
            for(int i=0;i<id.size();i++){
                for(int j=i+1;j<id.size();j++){
                    if(id[i]<id[j]){
                        swap(id[i],id[j]);
                        swap(is[i],is[j]);
                    }
                }
            }
            for(int i=0;i<id.size();i++){
                stringstream ss;
                if(is[i])ss<<"Switch on room ";
                else ss<<"Switch off room ";
                ss<<id[i]+1;
                ss<<".";
                getline(ss,s);
                log.push_back(s);
            }

        }


    }

    reverse(log.begin(),log.end());
    for(int i=0;i<log.size();i++)cout<<log[i]<<endl;
}





int main(){
    while(cin>>N>>M,N||M){
        for(int i=0;i<N;i++)G[i].clear();
        for(int i=0;i<N;i++)light[i].clear();

        for(int i=0;i<M;i++){
            int a,b;cin>>a>>b;a--;b--;
            G[a].push_back(b);
            G[b].push_back(a);
        }
        int bit=0;
        bool flag=false;
        for(int i=0;i<N;i++){
            int a;cin>>a;
            if(a)bit|=(1<<i);
            if(i==0&&a==0)flag=true;
        }


        for(int i=0;i<N;i++){
            int k;cin>>k;
            for(int j=0;j<k;j++){
                int a;cin>>a;a--;
                light[i].push_back(a);
            }
        }
        if(flag)cout<<"Help me!"<<endl;
        else solve(bit);
    }

    return 0;
}

Measured memory_bytes: 11936