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 <cstdio>
#include <string>
#include <map>
#include <vector>
#include <algorithm>
using namespace std;

#define REP(i,a,b) for(int i=a; i<b; i++)

typedef vector<int> lang;
vector<lang> people;

int N,M,L;
bool tr[30][30];

bool check(vector<int>& ret)
{
	REP(i,0,people.size())
	{
		bool g=false;
		REP(j,0,people[i].size())
		REP(k,0,ret.size())
		{
			if(people[i][j]==ret[k]) g=true;
		}
		
		if(!g) return false;
	}

	bool v[30][30]={0};
	REP(i,0,ret.size())
	REP(j,0,ret.size())
		if(tr[ret[i]][ret[j]]) v[ret[i]][ret[j]]=1;
		
	REP(k,0,N)
	REP(y,0,N)
	REP(x,0,N)
		v[x][y]|=(v[x][k]&v[k][y]);

	REP(i,0,people.size())
	REP(j,i+1, people.size())
	{
		bool g=false;
		REP(k,0,people[i].size())
		REP(l,0,people[j].size())
		{
			if(v[people[i][k]][people[j][l]]) g=true;
		}
		if(!g) return false;
	}
	return true;
}

bool conb(int p, int l, int pv, vector<int>& ret)
{
	if(p==l) 
	{
		if(check(ret)) return true;
		return false;
	}
	REP(i,pv+1,N-(l-p-1))
	{
		ret.push_back(i);
		if(conb(p+1,l,i,ret)) return true;
		ret.pop_back();
	}
	return false;
}


int main()
{
	bool f=true;
	while(scanf("%d%d",&N,&M),(N||M))
	{
		if(!f) puts("");
		f=false; 
		
		REP(i,0,30)
		REP(j,0,30)
		{
			tr[i][j]=0;
			if(i==j) tr[j][i]=1;
			tr[i][i]=1;
			tr[j][j]=1;
		}
		
		char buf[30];
		people.clear();
		map<string, int> d;
		vector<string> rd;
		
		REP(i,0,N)
		{
			scanf("%s", buf);
			d.insert(make_pair(string(buf), i));
			rd.push_back(string(buf));
		}
		
		vector<lang> People;
		while(M--)
		{
			lang per;
			scanf("%d", &L);
			while(L--)
			{
				scanf("%s", buf);
				map<string, int>::iterator it=d.find(string(buf));
				per.push_back(it->second);
			}
			people.push_back(per);
		}
		
		REP(i,0,people.size())
		REP(j,0,people[i].size())
		REP(k,j+1,people[i].size())
		{
			tr[people[i][j]][people[i][k]]=1;
			tr[people[i][k]][people[i][j]]=1;
		}

		vector<int> ret;
		REP(i,1,6)
		{
			if(conb(0,i,-1,ret)) break;
		}
		
		if(ret.empty()) puts("Impossible");
		else
		{
			vector<string> ans;
			REP(i,0,ret.size())
				ans.push_back(rd[ret[i]]);
			
			sort(ans.begin(), ans.end());
			
			printf("%d\n", ans.size());
			REP(i,0,ans.size())
				puts(ans[i].c_str());
		}
	}
}