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:
#define _USE_MATH_DEFINES
#define INF 0x3f3f3f3f
#include <iostream>
#include <cstdio>
#include <sstream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>
#include <list>
#include <complex>
#include <assert.h>

using namespace std;

typedef long long ll;
typedef pair <int,int> P;

static const double EPS = 1e-12;

static const int tx[] = {+0,+1,+0,-1};
static const int ty[] = {-1,+0,+1,+0};

class UnionFindTree {
  int* _par;
  int* _rank;
public:
  UnionFindTree(int N){
    _par = new int[N];
    _rank = new int[N];
    for(int i = 0; i < N; i++){
      _par[i] = i;
      _rank[i] = 0;
    }
  }

  ~UnionFindTree(){
    delete[] _par;
    delete[] _rank;
  }

  int find(int u){
    if(_par[u] == u) return u;
    return find(_par[u]);
  }

  bool unite(int u,int v){
    u = find(u);
    v = find(v);
    if(u == v) return false;
    
    if(_rank[u] < _rank[v]){
      _par[u] = v;
    }
    else{
      _par[v] = u;
      if(_rank[u] == _rank[v]) _rank[u]++;
    }
    return true;
  }
};

int main(){
  int num_of_languages;
  int num_of_students;
  bool is_first = true;
  while(~scanf("%d %d",&num_of_languages,&num_of_students)){
    if(num_of_languages == 0 && num_of_students == 0){
      break;
    }
    if(!is_first){
      printf("\n");
    }
    map<string,int> lang2idx;
    map<int,string> idx2lang;
    for(int lang_i = 0; lang_i < num_of_languages; lang_i++){
      string lang;
      cin >> lang;
      lang2idx[lang] = lang_i;
      idx2lang[lang_i] = lang;
    }

    int students[21] = {};
    for(int student_i = 0; student_i < num_of_students; student_i++){
      int num_of_skills;
      scanf("%d",&num_of_skills);
      for(int skill_i = 0; skill_i < num_of_skills; skill_i++){
        string skill;
        cin >> skill;
        students[student_i] |= (1 << lang2idx[skill]);
      }
    }

    int res = 0;


    for(int used = 1; used <= 5; used++){
      vector<int> languages;
      for(int i = 0; i < min(used,num_of_languages); i++){
        languages.push_back(1);
      }
      for(int i = 0; i < num_of_languages - used; i++){
        languages.push_back(0);
      }
      
      sort(languages.begin(),languages.end());
      do {
        int S = 0;
        for(int i = 0; i < languages.size(); i++){
          if(languages[i] == 1){
            S |= (1<<i);
          }
        }
        UnionFindTree uft(30);
        for(int student_i = 0; student_i < num_of_students; student_i++){
          for(int student_j = student_i + 1; student_j < num_of_students; student_j++){
            if(students[student_i] & students[student_j] & S){
              uft.unite(student_i,student_j);
            }
          }
        }
        
        set<int> parents;
        for(int student_i = 0; student_i < num_of_students; student_i++){
          parents.insert(uft.find(student_i));
        }
        if(parents.size() == 1){
          res = S;
          goto found;
        }
      } while(next_permutation(languages.begin(),languages.end()));
    }
  found:;

    if(res != 0){
      cout << __builtin_popcount(res) << endl;
      for(int lang_i = 0; lang_i < num_of_languages; lang_i++){
        if(res & (1<<lang_i)){
          cout << idx2lang[lang_i] << endl;
        }
      }
    }
    else{
      cout << "Impossible" << endl;
    }
    is_first = false;
  }
}