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 int long long
#define all(v) begin(v), end(v)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define reps(i, s, n) for(int i = (int)(s); i < (int)(n); i++)

template<class T1, class T2> void chmin(T1 &a, T2 b){if(a>b)a=b;}
template<class T1, class T2> void chmax(T1 &a, T2 b){if(a<b)a=b;}

using pint = pair<int, int>;
using tint = tuple<int, int, int>;
using vint = vector<int>;

const int inf = 1LL << 55;
const int mod = 1e9 + 7;

struct UnionFind
{
  vector<int> data;
  UnionFind(){}
  UnionFind(int sz):data(sz, -1){};
  int size(int x) { return -data[find(x)]; }
  int find(int x) { return data[x] < 0 ? x : data[x] = find(data[x]); }
  bool same(int x, int y) { return find(x) == find(y); }
  int unite(int x, int y)
  {
    x = find(x), y = find(y);
    if(x != y) {
      if(data[x] < data[y]) swap(x, y);
      data[x] += data[y]; data[y] = x;
    }
    return -data[x];
  }
  void init(int sz) {
    data.clear();
    data.resize(sz, -1);
  }
};

UnionFind uf;

int N, M;
vector<string> lang;
map<string, int> mp;
map<string, int> group;
vector<int> vec;
vector<string> ans;

bool input() {
  cin >> N >> M;
  if(!N && !M) return false;

  lang.clear();
  mp.clear();
  rep(i, N) {
    string l;
    cin >> l;
    lang.push_back(l);
    mp[l] = i;
  }

  vec.clear();
  group.clear();
  rep(i, M) {
    int k; cin >> k;
    int bit = 0;
    rep(j, k) {
      string l; cin >> l;
      bit |= 1<<mp[l];
      group[l] |= 1<<i;
    }
    vec.push_back(bit);
  }

  return true;
}

void solve(int idx, int bit) {
  if(__builtin_popcount(bit) > 5) return;
  if(uf.size(N) == __builtin_popcount(bit)+M) {
    if(ans.empty() || __builtin_popcountll(bit) < ans.size()) {
      ans.clear();
      rep(i, N) if((bit>>i)&1) ans.push_back(lang[i]);
    }
  }

  reps(i, idx, N) {
    if((bit>>i)&1) continue;
    UnionFind tmp = uf;
    rep(j, M) if((vec[j]>>i)&1) uf.unite(i, N+j);
    solve(i+1, bit|(1<<i));
    uf = tmp;
  }
}

signed main()
{
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  bool flag = false;
  while(input()) {
    if(flag) cout << endl;
    flag = true;

    ans.clear();
    uf.init(N+M);
    solve(0, 0);
    if(ans.size()) {
      cout << ans.size() << endl;
      for(string l : ans) cout << l << endl;
    } else {
      cout << "Impossible" << endl;
    }
  }
  return 0;
}