#include <string>
#include <vector>
#include <cmath>
#include <ctime>
#include <iostream>
#include <cstdio>
#include <set>
#include <map>
#include <queue>
#include <sstream>
#include <algorithm>
#include <numeric>
#include <cstring>
#include <limits>
using namespace std;
typedef long long ll;

const int INF = 100000;
struct State {
	int now, mask, cost;

	State(){}
	State(int _mask, int _now, int _cost)
		:now(_now), mask(_mask), cost(_cost){}

	bool operator>(const State& s) const {
		return cost > s.cost;
	}
};

int n, first;
bool conn[20][20];
bool sw[20][20];
int dist[(1<<15)+10][20];
State prev[(1<<15)+10][20];

string last_mes(int T){
	stringstream ss;
	ss << "You can go home in " << T << " steps.";
	return ss.str();
}

string switch_on_mes(int room){
	stringstream ss;
	ss << "Switch on room " << (room + 1) << ".";
	return ss.str();
}


string switch_off_mes(int room){
	stringstream ss;
	ss << "Switch off room " << (room + 1) << ".";
	return ss.str();
}

string move_mes(int room){
	stringstream ss;
	ss << "Move to room " << (room + 1) << ".";
	return ss.str();
}


void finish(State S){
	vector<string> res;
	for(int T=0;;T++){
		if(S.mask == first && S.now == 0){
			res.push_back(last_mes(T));
			break;
		} else {
			State P = prev[S.mask][S.now];
			if(S.now != P.now){
				res.push_back(move_mes(S.now));
			} else {
				for(int i=0;i<n;i++){
					int s = (S.mask >> i) & 1;
					int p = (P.mask >> i) & 1;
					if(s == p)continue;
					if(s){
						res.push_back(switch_on_mes(i));
					} else {
						res.push_back(switch_off_mes(i));
					}
					break;
				}
			}
			S = P;
		}
	}

	for(int i=res.size()-1;i>=0;i--)cout << res[i] << endl;
}

void solve(int init){
	first = init;
	for(int i=0;i<1<<n;i++)for(int j=0;j<n;j++){
		dist[i][j] = INF;
	}

	priority_queue<State, vector<State>, greater<State> > Q;

	dist[init][0] = 0;
	Q.push(State(init, 0, 0));

	int goal_num = n - 1;
	int goal_mask = 1 << goal_num;

	bool can_goal = false;
	while(!Q.empty()){
		State S = Q.top(); Q.pop();
		if(dist[S.mask][S.now] < S.cost)continue;

		if(S.mask == goal_mask && S.now == goal_num){
			//終了処理
			finish(S);
			return;
		}

		if(S.now == goal_num){
			can_goal = true;
		}

		//移動
		for(int next=0;next<n;next++)if(conn[S.now][next]){
			if((S.mask >> next) & 1){
				int cost = S.cost + 1;
				if(cost < dist[S.mask][next]){
					dist[S.mask][next] = cost;
					prev[S.mask][next] = S;
					Q.push(State(S.mask, next, cost));
				}
			}
		}

		//パネル操作
		for(int turn=0;turn<n;turn++)if(turn != S.now && sw[S.now][turn]){
			int next_mask = S.mask ^ (1 << turn);
			int cost = S.cost + 1;

			if(cost < dist[next_mask][S.now]){
				dist[next_mask][S.now] = cost;
				prev[next_mask][S.now] = S;
				Q.push(State(next_mask, S.now, cost));
			}
		}
	}

	if(can_goal){
		cout << "You can not switch off all lights." << endl;
	} else {
		cout << "Help me!" << endl;
	}
}

int main(){
	int m;
	while(cin >> n >> m, n || m){
		memset(conn, false, sizeof(conn));
		memset(sw, false, sizeof(sw));

		for(int i=0;i<m;i++){
			int s, t;
			cin >> s >> t;

			--s;
			--t;

			conn[s][t] = true;
			conn[t][s] = true;
		}

		int mask = 0;
		for(int i=0;i<n;i++){
			int f;
			cin >> f;

			mask |= f << i;
		}

		for(int i=0;i<n;i++){
			int k;
			cin >> k;

			for(int j=0;j<k;j++){
				int r;
				cin >> r;

				--r;

				sw[i][r] = true;
			}
		}

		solve(mask);
	}

	return 0;
}