#include <bits/stdc++.h>

using namespace std;

int main() {
    map<string, int> mp;

    int q;
    cin >> q;
    while (q--) {
        int op;
        string s;
        cin >> op >> s;
        if (op == 0) {
            int x;
            cin >> x;
            mp[s] = x;
        } else if (op == 1) {
            cout << mp[s] << endl;
        } else {
            mp.erase(s);
        }
    }
    return 0;
}

