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>

using namespace std;

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

namespace tree {
struct union_find {
  static const int Max = 22;
  int par[Max], rank[Max], size[Max], compnum;

  union_find(int N) {
    compnum = N;
    for(int i=0; i<N; i++) {
      par[i] = i;
      rank[i] = 0;
      size[i] = 1;
    }
  }

  int root(int x) {
    return par[x] == x ? x : par[x] = root(par[x]);
  }

  void unite(int x, int y) {
    x = root(x), y = root(y);
    if(x == y) return;
    if(rank[x] < rank[y]) {
      par[x] = y, size[y] += size[x];
    } else {
      par[y] = x, size[x] += size[y];
      if(rank[x] == rank[y]) rank[x]++;
    }
    compnum--;
  }

  int operator[](int x) { return root(x); }
  void operator()(int x, int y) { return unite(x, y); }

  bool same(int x, int y) { return root(x) == root(y); }
  int size_of(int x) { return size[root(x)]; }
  int num_of_comps() { return compnum; }
};
}

int N, M;
unordered_map<string, int> idmap;
vector<string> langs;
bool speaks[23][33];

void input() {
  langs.clear(); langs.resize(N);
  rep(i, N) {
    cin >> langs[i];
    idmap[langs[i]] = i;
  }
  memset(speaks, 0, sizeof speaks);
  rep(i, M) {
    int k; cin >> k;
    rep(_, k) {
      string s; cin >> s;
      speaks[i][idmap[s]] = 1;
    }
  }
}

bool next_combination(int& comb, int const BitSize) {
  int x = comb & -comb, y = comb + x;
  comb = ((comb & ~y) / x >> 1) | y;
  return comb < 1 << BitSize;
}

void solve() {

  REP(K, 1, min(N + 1, 6)) {
    int comb = (1 << K) - 1;
    do {
      vector<int> uselangs;
      rep(i, N) {
        if(!(comb & 1 << i)) continue;
        uselangs.push_back(i);
      }

      tree::union_find uf(M);

      rep(i, M) REP(j, i + 1, M)
        for(auto langid: uselangs)
          if(speaks[i][langid] && speaks[j][langid])
            uf(i, j);

      if(uf.num_of_comps() == 1) {
        printf("%d\n", (int)uselangs.size());
        for(auto e: uselangs) printf("%s\n", langs[e].c_str());
        return;
      }
    } while(next_combination(comb, N));
  }
  puts("Impossible");
}

int main() {
  bool first = 0;
  for(; cin >> N >> M && (N|M);) {
    if(first) cout << endl;
    first = 1;
    input();
    solve();
  }
  
  return 0;
}