#include #include #include using namespace std; map > lib[6]; int main() { int N,id; string temp; cin >> N; for (int i = 0; i < N; i++) { cin >> id; getchar(); getline(cin, temp); lib[1][temp].insert(id); getline(cin, temp); lib[2][temp].insert(id); while(cin >> temp) { lib[3][temp].insert(id); if(getchar() == '\n') break; } getline(cin, temp); lib[4][temp].insert(id); getline(cin, temp); lib[5][temp].insert(id); } cin >> N; for (int i = 0; i < N; i++) { scanf("%d: ", &id); getline(cin, temp); cout << id << ": " << temp << endl; auto ans = lib[id].find(temp); if (ans == lib[id].end()) cout << "Not Found" << endl; else for (auto it : lib[id][temp]) printf("%07d\n", it); } }