#include <iostream>
#include "unordered_map"
using namespace std;
struct student {
    string name;
    string sex;
    int age;
    
    
};
int main() {
    int N;
    while (cin >> N) { // 注意 while 处理多个 case
        // cout << a + b << endl;
        unordered_map <int, student> myMap;
        while (N--) {
            int num;
            string name;
            string sex;
            int age;
            cin >> num >> name >> sex >> age;
            // myMap.insert(pair<int,student>(num,student(name, sex, age))) ;
            student temp;
            temp.name=name;
            temp.age=age;
            temp.sex=sex;
            myMap[num]=temp;//使用下标访问时结构体必须是可默认构造的
        }
        int M;
        cin >> M;
        while (M--) {
            int num;
            cin >> num;
            if (myMap.find(num) == myMap.end())
                cout << "No Answer!" << endl;
            else {
                student result = myMap.find(num)->second;
                cout << num << ' ' << result.name << ' ' << result.sex << ' ' << result.age <<
                     endl;
            }

        }
    }
}
// 64 位输出请用 printf("%lld")