#include #include #include using std::string; using std::vector; using std::cin; struct Query { string type, name; int number; }; vector read_queries() { int n; cin >> n; vector queries(n); for (int i = 0; i < n; ++i) { cin >> queries[i].type; if (queries[i].type == "add") cin >> queries[i].number >> queries[i].name; else cin >> queries[i].number; } return queries; } void write_responses(const vector& result) { for (size_t i = 0; i < result.size(); ++i) std::cout << result[i] << "\n"; } vector process_queries(const vector& queries) { vector result; vector contacts(10000000); for (size_t i = 0; i < queries.size(); ++i) { int j = queries[i].number; if (queries[i].type == "add") { contacts[j] = queries[i].name; } else if (queries[i].type == "del") { contacts[j] = ""; } else { if (contacts[j].empty()) result.push_back("not found"); else result.push_back(contacts[j]); } } return result; } int main() { write_responses(process_queries(read_queries())); return 0; }