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 <stdio.h>
#include <cmath>
#include <algorithm>
#include <cfloat>
#include <stack>
#include <queue>
#include <vector>
#include <string>
#include <iostream>
#include <set>
#include <map>
#include <time.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;

int N,M;
char name[30][21];

int check[20];

int boss[20],height[20];
int POW[31];

int get_boss(int id){
	if(boss[id] == id)return id;
	else{
		return boss[id] = get_boss(boss[id]);
	}
}

void unite(int x,int y){
	int boss_x = get_boss(x);
	int boss_y = get_boss(y);

	if(boss_x == boss_y)return;

	if(height[x] > height[y]){

		boss[boss_y] = boss_x;

	}else if(height[x] < height[y]){

		boss[boss_x] = boss_y;

	}else{ //height[x] == height[y]

		boss[boss_y] = boss_x;
		height[x]++;
	}
}

void init(){
	for(int i = 0; i < M; i++){
		boss[i] = i;
		height[i] = 0;
	}
}

bool strCmp(char* base, char* comp){
	int length1,length2;
	for(length1=0;base[length1] != '\0';length1++);
	for(length2=0;comp[length2] != '\0';length2++);
	if(length1 != length2)return false;

	for(int i=0;base[i] != '\0'; i++){
		if(base[i] != comp[i])return false;
	}
	return true;
}

int data_set = 0;

void func(){

	if(data_set != 0){
		printf("\n");
	}
	data_set++;

	for(int i = 0; i < N; i++){
		scanf("%s",name[i]);
	}

	for(int i = 0; i < M; i++)check[i] = 0;

	char buf[21];
	int num;

	for(int i = 0; i < M; i++){
		scanf("%d",&num);
		for(int k = 0; k < num; k++){
			scanf("%s",buf);
			for(int p = 0; p < N; p++){
				if(strCmp(name[p],buf)){
					check[i] += POW[p];
					break;
				}
			}
		}
	}

	bool FLG;
	int S;

	for(int a = 0; a < N; a++){
		FLG = true;
		S = POW[a];

		for(int i = 0; i < M; i++){
			if((check[i] & S) == 0){
				FLG = false;
				break;
			}
		}

		if(FLG){
			printf("1\n");
			printf("%s\n",name[a]);
			return;
		}
	}

	int count;

	for(int a = 0; a < N-1; a++){
		for(int b = a+1; b < N; b++){
			S = POW[a]+POW[b];
			init();

			for(int i = 0; i < M-1; i++){
				for(int k = i+1; k < M; k++){
					if(check[i]&check[k]&S){
						unite(i,k);
					}
				}
			}

			count = 0;
			for(int i = 0; i < M; i++){
				if(get_boss(i) == i)count++;
			}

			if(count == 1){
				printf("2\n");
				printf("%s\n",name[a]);
				printf("%s\n",name[b]);
				return;
			}
		}
	}


	for(int a = 0; a < N-2; a++){
		for(int b = a+1; b < N-1; b++){
			for(int c = b+1; c < N; c++){
				S = POW[a]+POW[b]+POW[c];
				init();

				for(int i = 0; i < M-1; i++){
					for(int k = i+1; k < M; k++){
						if(check[i]&check[k]&S){
							unite(i,k);
						}
					}
				}

				count = 0;
				for(int i = 0; i < M; i++){
					if(get_boss(i) == i)count++;
				}

				if(count == 1){

					printf("3\n");
					printf("%s\n",name[a]);
					printf("%s\n",name[b]);
					printf("%s\n",name[c]);
					return;

				}
			}
		}
	}

	for(int a = 0; a < N-3; a++){
		for(int b = a+1; b < N-2; b++){
			for(int c = b+1; c < N-1; c++){
				for(int d = c+1; d < N; d++){
					S = POW[a]+POW[b]+POW[c]+POW[d];
					init();

					for(int i = 0; i < M-1; i++){
						for(int k = i+1; k < M; k++){
							if(check[i]&check[k]&S){
								unite(i,k);
							}
						}
					}

					count = 0;
					for(int i = 0; i < M; i++){
						if(get_boss(i) == i)count++;
					}

					if(count == 1){
						printf("4\n");
						printf("%s\n",name[a]);
						printf("%s\n",name[b]);
						printf("%s\n",name[c]);
						printf("%s\n",name[d]);
						return;
					}
				}
			}
		}
	}

	for(int a = 0; a < N-4; a++){
		for(int b = a+1; b < N-3; b++){
			for(int c = b+1; c < N-2; c++){
				for(int d = c+1; d < N-1; d++){
					for(int e = d+1; e < N; e++){
						S = POW[a]+POW[b]+POW[c]+POW[d]+POW[e];
						init();

						for(int i = 0; i < M-1; i++){
							for(int k = i+1; k < M; k++){
								if(check[i]&check[k]&S){
									unite(i,k);
								}
							}
						}

						count = 0;
						for(int i = 0; i < M; i++){
							if(get_boss(i) == i)count++;
						}

						if(count == 1){
							printf("5\n");
							printf("%s\n",name[a]);
							printf("%s\n",name[b]);
							printf("%s\n",name[c]);
							printf("%s\n",name[d]);
							printf("%s\n",name[e]);
							return;
						}
					}
				}
			}
		}
	}

	printf("Impossible\n");
}

int main(){

	for(int i = 0; i < 31; i++)POW[i] = pow(2,i);

	while(true){
		scanf("%d %d",&N,&M);
		if(N == 0 && M == 0)break;

		func();
	}

	return 0;
}