#include<bits/stdc++.h>
#define _USE_MATH_DEFINES
#include<math.h>
#define fast std::ios::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
#define ll long long
#define test cout<<"xyz\n"
#define debug(x) cout<<x<<" "
#define debug1(x) cout<<x<<"\n"
#define debug2(x,y) cout<<x<<" "<<y<<"\n"
#define pb push_back
#define pi pair<int,int>
#define fi first
#define si second
#define mod (ll)1000000007
#define PI2 (double)22/7
#define PI (long double)3.141592653589793238462643383279502884L
using namespace std;
typedef struct trieNode
{
    vector<string>v;
    struct trieNode* child[26];
}trieNode;
trieNode* newNode()
{
    trieNode* t = new trieNode;
    t->v.clear();
    for(int i=0;i<26;i++){
        t->child[i]=NULL;
    }
    return t;
}
void insert(trieNode* root, string s)
{
    trieNode* curr = root;
    for(int i=0;i<s.length();i++){
        int x = s[i]-'a';
        if(curr->child[x] == NULL){
            curr->child[x] = newNode();
        }
        curr->child[x]->v.pb(s);
        curr = curr->child[x];
    }
    return;
}
vector<string> getDictionary(trieNode* root, string s)
{
    trieNode* curr = root;
    vector<string>ans;
    int ii=0;
    for(int i=0;i<s.length();i++){
        int x = s[i]-'a';
        if(curr->child[x]!=NULL){
            //test;
            ans = curr->child[x]->v;
            curr = curr->child[x];
        }
        else{
            ii=1;
            break;
        }
    }
    vector<string>temp;
    return (ii == 1) ? temp : ans;
}
int main()
{
    fast;
    int n; cin>>n;
    string s;
    trieNode* root = newNode();
    for(int i=1;i<=n;i++){
        cin>>s;
        insert(root, s);
    }
    int q; cin>>q;
    while(q--){
        cin>>s;
        vector<string>ans = getDictionary(root, s);
        if(ans.size() == 0){
            debug1("No suggestions");
        }
        else{
            sort(ans.begin(), ans.end());
            for(auto &it:ans){
                debug1(it);
            }
        }
    }
    return 0;
}
