Problem: Isaac H. Ives is attending an international student party (maybe for girl-hunting). Students there enjoy talking in groups with excellent foods and drinks. However, since students come to the party from all over the world, groups may not have a language spoken by all students of the group. In such groups, some student(s) need to work as interpreters, but intervals caused by interpretation make their talking less exciting.

Needless to say, students want exciting talks. To have talking exciting as much as possible, Isaac proposed the following rule: the number of languages used in talking should be as little as possible, and not exceed five. Many students agreed with his proposal, but it is not easy for them to find languages each student should speak. So he calls you for help.

Your task is to write a program that shows the minimum set of languages to make talking possible, given lists of languages each student speaks.



Input

The input consists of a series of data sets.

The first line of each data set contains two integers N (1 ≤ N ≤ 30) and M (2 ≤ M ≤ 20) separated by a blank, which represent the numbers of languages and students respectively. The following N lines contain language names, one name per line. The following M lines describe students in the group. The i-th line consists of an integer Ki that indicates the number of languages the i-th student speaks, and Ki language names separated by a single space. Each language name consists of up to twenty alphabetic letters.

A line that contains two zeros indicates the end of input and is not part of a data set.

Output

Print a line that contains the minimum number L of languages to be spoken, followed by L language names in any order. Each language name should be printed in a separate line. In case two or more sets of the same size is possible, you may print any one of them. If it is impossible for the group to enjoy talking with not more than five languages, you should print a single line that contains “Impossible” (without quotes).

Print an empty line between data sets.

Example

Input

3 4
English
French
Japanese
1 English
2 French English
2 Japanese English
1 Japanese
2 2
English
Japanese
1 English
1 Japanese
6 7
English
Dutch
German
French
Italian
Spanish
1 English
2 English Dutch
2 Dutch German
2 German French
2 French Italian
2 Italian Spanish
1 Spanish
0 0


Output

2
English
Japanese

Impossible

Impossible

Solution (in CPP):

Solution:
#include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
const ld eps = 1e-9;

template < class BidirectionalIterator >
bool next_combination(BidirectionalIterator first1,
	BidirectionalIterator last1,
	BidirectionalIterator first2,
	BidirectionalIterator last2)
{
	if ((first1 == last1) || (first2 == last2)) {
		return false;
	}
	BidirectionalIterator m1 = last1;
	BidirectionalIterator m2 = last2; --m2;
	while (--m1 != first1 && !(*m1 < *m2)) {
	}
	bool result = (m1 == first1) && !(*first1 < *m2);
	if (!result) {
		// ①
		while (first2 != m2 && !(*m1 < *first2)) {
			++first2;
		}
		first1 = m1;
		std::iter_swap(first1, first2);
		++first1;
		++first2;
	}
	if ((first1 != last1) && (first2 != last2)) {
		// ②
		m1 = last1; m2 = first2;
		while ((m1 != first1) && (m2 != last2)) {
			std::iter_swap(--m1, m2);
			++m2;
		}
		// ③
		std::reverse(first1, m1);
		std::reverse(first1, last1);
		std::reverse(m2, last2);
		std::reverse(first2, last2);
	}
	return !result;
}

template < class BidirectionalIterator >
bool next_combination(BidirectionalIterator first,
	BidirectionalIterator middle,
	BidirectionalIterator last)
{
	return next_combination(first, middle, middle, last);
}


struct UnionFind {
	vector<int> data;
	UnionFind(int size) : data(size, -1) { }
	bool unionSet(int x, int y) {
		x = root(x); y = root(y);
		if (x != y) {
			if (data[y] < data[x]) swap(x, y);
			data[x] += data[y]; data[y] = x;
		}
		return x != y;
	}
	int root(int x) {
		return data[x] < 0 ? x : data[x] = root(data[x]);
	}
	int size(int x) {
		return -data[root(x)];
	}
};


int main() {
	cout<<setprecision(10)<<fixed;

	int tt=false;
	while (true){
		int N,M;cin>>N>>M;
		if(!N)break;

		if (tt)cout << endl;
		tt = true;
		map<string,int>mp;
		map<int,string>revmp;
		{
			for (int i = 0; i < N; ++i) {
				string st;cin>>st;
				mp[st]=i;
				revmp[i]=st;
			}
		}
		vector<vector<int>>langs(M,vector<int>(N));
		for (int i = 0; i < M; ++i) {
			int k;cin>>k;
			for (int j = 0; j < k; ++j) {
				string st;cin>>st;
				langs[i][mp[st]]=true;
			}
		}
		vector<int>perms(N);
		iota(perms.begin(),perms.end(),0);

		vector<string>anss;

		for (int t = 1; t <= (min(N, 5)); ++t) {
			do {
				UnionFind uf(M + min(N, 5));
				for (int i = 0; i < M; ++i) {
					for (int j = 0; j < t; ++j) {
						int lang_id = perms[j];
						if (langs[i][lang_id])uf.unionSet(i, M + j);

						for (int k = 1; k <t; ++k) {
							int lang_id2 = perms[k];
							if (langs[i][lang_id] && langs[i][lang_id2]) {
								uf.unionSet(M + j, M + k);
							}
						}
					}
				}
				set<int>aset;
				for (int i = 0; i < M + t; ++i) {
					aset.emplace(uf.root(i));
				}
				if (aset.size() == 1) {
					for (int i = 0; i < t; ++i) {
						anss.emplace_back(revmp[perms[i]]);
					}
					break;
				}
			} while (next_combination(perms.begin(), perms.begin() + t, perms.end()));
			if(!anss.empty())break;
		}
		if (anss.empty()) {
			cout << "Impossible" << endl;
		}
		else {
			cout<<anss.size()<<endl;
			for(auto ans:anss)cout<<ans<<endl;
		}
	}
	return 0;
}