#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <sstream>
#include <iomanip>
#include <queue>
#include <ctime>
using namespace std;
template <class T> void checkmin(T &t,T x){if (x < t) t = x;}
template <class T> void checkmax(T &t,T x){if (x > t) t = x;}
template <class T> void _checkmin(T &t, T x){if (t == -1) t = x; if (x < t) t = x;}
template <class T> void _checkmax(T &t, T x){if (t == -1) t = x; if (x > t) t = x;}
typedef pair <int,int> PII;
typedef pair <double,double> PDD;
typedef long long lld;
#define foreach(it,v) for (__typeof((v).begin()) it = (v).begin();it != (v).end();it++)
#define DEBUG(a) cout << #a" = " << (a) << endl;
#define DEBUGARR(a, n) for (int i = 0; i < (n); i++) { cout << #a"[" << i << "] = " << (a)[i] << endl; }
struct nodes{
	nodes *next[26];
	int no;
}node[1000000];
int tot;
int code(char c){
	if (c>='A'&&c<='Z') return c-'A';
	if (c>='a'&&c<='z') return c-'a';
}
nodes *newnode(){
	memset(node[tot].next,0,sizeof(node[tot].next));
	node[tot].no = -1;
	return &node[tot++];
}

void insert(nodes *p,char s[],int no){
	for (int i=0;s[i];i++){
		int c = code(s[i]);
		if (p->next[c]==0) p->next[c] = newnode();
		p = p->next[c];
	}
	if (p->no==-1) p->no = no;
}
int f[10000],g[10000],multi[10000],path[10000],Len[10000];
char ins[5100][5100];
int ans[10000];
char str[10000];
int main(){
#ifdef cwj
	freopen("in", "r", stdin);
#endif
	int tt;
	int i,j,N,M,len;
	scanf("%d",&tt);
	while(tt--){
		tot = 0;
		nodes *root = newnode();
		scanf("%d",&N);
		for (i=0;i<N;i++){
			scanf("%s",ins[i]);
			Len[i] = strlen(ins[i]);
			insert(root,ins[i],i);
		}
		scanf("%d",&M);
		while(M--){
			scanf("%s",str+1);
			str[0] = ' ';
			len = strlen(str);
			for (i=1;i<len;i++)
				str[i] = code(str[i]),f[i] = g[i] = -1;
			f[0] = g[0] = 0;
			for (i=0;i<len;i++)
				if (f[i]!=-1){
					nodes *p = root;
					for (j=i+1;j<len;j++)
					{
						p = p->next[str[j]];
						if (p==0) break;
						if (p->no>=0){
							if (f[j]==-1){
								f[j] = f[i]+1;
								g[j] = g[i]+p->no;
								multi[j] = 0;
								path[j] = p->no;
							}else if (f[j]>f[i]+1){
								f[j] = f[i]+1;
								g[j] = g[i]+p->no;
								path[j] = p->no;
							}else if (f[j]==f[i]+1&&g[j]<g[i]+p->no){
								g[j] = g[i]+p->no;
								path[j] = p->no;
							}else if (f[j]==f[i]+1&&g[j]==g[i]+p->no){
								multi[j] = 1;
							}
						}
					}
				}
			N = len-1;
			if (f[N]==-1) printf("\n");
			else if (multi[N]) printf("Too Obvious\n");
			else {
				int now = N,t = 0;
				while(now!=0){
					ans[t++] = path[now];
					now -= Len[path[now]];
				}
				for (i=t-1;i>=0;i--){
					printf("[");
					printf("%s",ins[ans[i]]);
					printf("]");
				}
				printf("\n");
			}
		}
	}






}
