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

#define BIT(x) (1 << (x))

struct State {
	int cur;
	int light;
	vector<pair<int, int> > log;
	State(){}
};

const int MOVE = 1;
const int OFF = 2;
const int ON = 3;

int n, m;
vector<int> g[15];
vector<int> sw[15];
bool vis[15][1 << 15];

State initial;

void solve()
{
	memset(vis, 0, sizeof(vis));
	
	int ca = 3;
	vector<pair<int, int> > res;
	
	queue<State> q;
	if (initial.light & BIT(0)) q.push(initial);
	
	while (q.size()){
		State st = q.front();
		q.pop();
			
		if (vis[st.cur][st.light]) continue;
		vis[st.cur][st.light] = true;
		
		if (st.cur == n - 1){
			if (st.light == BIT(n - 1)){
				ca = 1;
				res = st.log;
				break;
			}
			else ca = 2;
		}
		
		for (int i = 0; i < g[st.cur].size(); i++){
			State nx = st;
			nx.cur = g[st.cur][i];
			if (st.light & BIT(g[st.cur][i])){
				nx.log.push_back(make_pair(MOVE, nx.cur));
				q.push(nx);
			}
		}
		
		for (int i = 0; i < sw[st.cur].size(); i++){
			State nx = st;
			nx.light ^= BIT(sw[st.cur][i]);
			if (nx.light & BIT(sw[st.cur][i])){
				nx.log.push_back(make_pair(ON, sw[st.cur][i]));
			}
			else {
				nx.log.push_back(make_pair(OFF, sw[st.cur][i]));
			}
			q.push(nx);
		}
	}
	
	if (ca == 1){
		printf("You can go home in %d steps.\n", res.size());
		for (int i = 0; i < res.size(); i++){
			if (res[i].first == MOVE){
				printf("Move to room %d.\n", res[i].second + 1);
			}
			else if (res[i].first == OFF){
				printf("Switch off room %d.\n", res[i].second + 1);
			}
			else if (res[i].first == ON){
				printf("Switch on room %d.\n", res[i].second + 1);
			}
		}
	}
	else if (ca == 2){
		puts("You can not switch off all lights.");
	}
	else if (ca == 3){
		puts("Help me!");
	}
}

int main()
{
	while (scanf("%d %d", &n, &m), n){
		for (int i = 0; i < 15; i++){
			g[i].clear();
			sw[i].clear();
		}
		
		for (int i = 0; i < m; i++){
			int s, t;
			scanf("%d %d", &s, &t);
			g[--s].push_back(--t);
			g[t].push_back(s);
		}
		
		int light = 0;
		for (int i = 0; i < n; i++){
			int a;
			scanf("%d", &a);
			if (a) light |= BIT(i);
		}
		
		for (int i = 0; i < n; i++){
			int k;
			scanf("%d", &k);
			for (int j = 0; j < k; j++){
				int r;
				scanf("%d", &r);
				sw[i].push_back(--r);
			}
			sort(sw[i].begin(), sw[i].end());
		}
		
		initial.cur = 0;
		initial.light = light;
		initial.log.clear();
		
		solve();
	}
}