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 <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

class UnionFindTree
{
    int n;
    vector<int> parent; // 親ノード
    vector<int> rank;   // 木の高さの上限
    vector<int> num;    // グループの要素数
    int find(int x){
        if(parent[x] == x)
            return x;
        return parent[x] = find(parent[x]);
    }
public:
    UnionFindTree(int n0){ // コンストラクタ
        n = n0;
        parent.resize(n);
        for(int i=0; i<n; ++i)
            parent[i] = i;
        rank.assign(n, 0);
        num.assign(n, 1);
    }
    void unite(int x, int y){ // xとyのグループを併合
        if((x = find(x)) != (y = find(y))){
            if(rank[x] < rank[y]){
                parent[x] = y;
                num[y] += num[x];
            }else{
                parent[y] = x;
                if(rank[x] == rank[y])
                    ++ rank[x];
                num[x] += num[y];
            }
            -- n;
        }
    }
    bool same(int x, int y){ // xとyのグループが同じかを調べる
        return find(x) == find(y);
    }
    int getNum(){ // グループの数を返す
        return n;
    }
    int getNum(int x){ // xのグループの要素数を返す
        return num[find(x)];
    }
};

template <size_t T>
bool nextBitset(bitset<T> &bs, int digit)
{
    if(bs.none())
        return false;
    bitset<T> x, y, z;
    x = bs.to_ulong() & (~(bs.to_ulong()) + 1ULL);
    y = bs.to_ulong() + x.to_ulong() + 0ULL;
    z = bs & ~y;
    if(bs[digit-1] && bs == z)
        return false;
    bs = ((z.to_ulong() / x.to_ulong()) >> 1) + 0ULL;
    bs |= y;
    return true;
}

int n, m;
vector<string> name;
vector<bitset<30> > use;

void solve()
{
    for(int i=1; i<=min(5, n); ++i){
        bitset<30> bs((1<<i)-1);
        do{
            UnionFindTree uft(m);
            for(int j=0; j<m; ++j){
                for(int k=0; k<j; ++k){
                    if((use[j] & use[k] & bs).any())
                        uft.unite(j, k);
                }
            }

            if(uft.getNum() == 1){
                cout << i << endl;
                for(int j=0; j<n; ++j){
                    if(bs[j])
                        cout << name[j] << endl;
                }
                return;
            }
        }while(nextBitset(bs, n));
    }

    cout << "Impossible" << endl;
}

int main()
{
    bool isFirst = true;

    for(;;){
        cin >> n >> m;
        if(n == 0)
            return 0;

        name.resize(n);
        map<string, int> index;
        for(int i=0; i<n; ++i){
            cin >> name[i];
            index[name[i]] = i;
        }

        use.assign(m, 0);
        for(int i=0; i<m; ++i){
            int a;
            cin >> a;
            for(int j=0; j<a; ++j){
                string s;
                cin >> s;
                use[i][index[s]] = true;
            }
        }

        if(isFirst)
            isFirst = false;
        else
            cout << endl;

        solve();
    }
}