#include <bits/stdc++.h>

using namespace std;
map<string,int> mp;
map<string,int>::iterator itr;

int main()
{
   
    int n, q, val;
    string key;
    cin>>n;
    while(n--){
        cin>>q;
        switch (q)
        {
            case 0:
                cin>>key>>val;
                mp[key]=val;
                break;

            case 1:
                cin>>key;
                itr=mp.find(key);
                if(itr!=mp.end()) cout<<itr->second<<endl;
                else cout<<0<<endl;
                break;
            case 2:
                cin>>key;
                mp.erase(key);
                break;
        }
    }


    return 0;
}

