#define _USE_MATH_DEFINES
#include <iostream>
#include <complex>
#include <algorithm>
#include <vector>
#include <stack>
#include <string>
#include <queue>
#include <cmath>
#include <math.h>
#include <numeric>
#include <list>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <climits>
#include <set>
#include <memory.h>
#include <memory>
#include <cstdio>
#include <cstdlib>
#include <cctype>
#include <cassert>
#include <map>
#include <cassert>
#include <time.h>
#include <ctime>

using namespace std;

typedef complex<double> xy_t;
typedef pair<xy_t, xy_t> line;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<int , P> PP;
typedef pair<int, string> Ps;
typedef vector<int> vec;
typedef vector<vec> mat;
const int INF = 1 << 27;
const double EPS = 1e-9;
const double PI = 3.1415926535897932384626433832795;
const int CLK = CLOCKS_PER_SEC;

#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, m, n) for(int i = m; i < n; i++)

int start;
int memo[15][1 << 15];
P pre[15][1 << 15];
P did[15][1 << 15];
bool g[15][15];
vector<int> sw[15];

void change(vector<P> &vp){
	int n = vp.size();
	rep(i, n){
		rep(j, n-1){
			if(vp[j].first * vp[j+1].first != 0 && vp[j].second > vp[j+1].second)
				swap(vp[j], vp[j+1]);
		}
	}
}

void goal_output(int v, int room){
	cout << "You can go home in " << memo[v][room] << " steps." << endl;
	P st = P(v, room), d;
	vector<P> res;
	rep(i, memo[v][room]){
		res.push_back(did[st.first][st.second]);
		st = pre[st.first][st.second];
	}
	reverse(res.begin(), res.end());
	change(res);
	rep(i, (int)res.size()){
		d = res[i];
		assert(d.first != -2);
		if(d.first == 1){
			cout << "Switch on room " << d.second + 1<< "." << endl;
		}else if(d.first == -1){
			cout << "Switch off room " << d.second + 1<< "." << endl;
		}else{
			cout << "Move to room " << d.second + 1<< "." << endl;
		}
	}
}

int main(){
	int n, m, k, s, t, b;
	int r;
	bool ok1, ok2;
	while(cin >> n >> m && (n || m)){
		ok1 = ok2 = false;
		rep(i, n) sw[i].clear();
		memset(g, false, sizeof(g));
		memset(memo, -1, sizeof(memo));
		fill(&pre[0][0], &pre[14][(1 << 15) - 1] + 1, P(-2, -1));
		fill(&did[0][0], &did[14][(1 << 15) - 1] + 1, P(-2, -1));
		rep(i, m){
			cin >> s >> t;
			s--, t--;
			g[s][t] = g[t][s] = true;
		}
		start = 0;
		rep(i, n){
			cin >> b;
			if(b) start |= 1 << i;
		}
		rep(i, n){
			cin >> k;
			rep(j, k){
				cin >> r;
				sw[i].push_back(--r);
			}
			sort(sw[i].begin(), sw[i].end());
		}
		queue<P> que;
		que.push(P(0, start));
		memo[0][start] = 0;
		if(!(start & 1)){
			cout << "Help me!" << endl;
			continue;
		}
		while(!que.empty()){
			P st = que.front();
			int v = st.first;
			int room = st.second;
			que.pop();
			if(v == n-1) ok1 = true;
			if(v == n-1 && room == (1 << (n - 1))){
				ok2 = true;
				goal_output(v, room);
			}
			rep(i, n){
				if(i == v || !g[v][i] || !(room & (1 << i))) continue;
				if(memo[i][room] == -1){
					memo[i][room] = memo[v][room] + 1;
					pre[i][room] = P(v, room);
					did[i][room] = P(0, i);
					que.push(P(i, room)); 
				}
			}
			rep(i, (int)sw[v].size()){
				if(v == sw[v][i]) continue;
				int room2 = room ^ (1 << sw[v][i]);
				if(memo[v][room2] == -1){
					memo[v][room2] = memo[v][room] + 1;
					pre[v][room2] = P(v,room);
					did[v][room2] = P((room2 > room) ? 1 : -1, sw[v][i]);
					que.push(P(v, room2));
				}
			}
		}
		if(ok2) continue;
		if(ok1){
			cout << "You can not switch off all lights." << endl;
		}else{
			cout << "Help me!" << endl;
		}
	}
	return 0;
}