#include <iostream>
#include <unordered_map>

int main() {
    int q;
    std::cin >> q;

    std::unordered_map<std::string, int> M;
    for (int i = 0; i < q; i++) {
        int op;
        std::string key;
        std::cin >> op >> key;
        if (op == 0) {
            int x;
            std::cin >> x;
            M[key] = x;
        } else if (op == 1) {
            if (M.count(key) > 0) {
                std::cout << M[key] << std::endl;
            } else {
                std::cout << 0 << std::endl;
            }
        } else if (op == 2) {
            M.erase(key);
        }
    }
}

