#include <iostream>
#include<list>
#include<vector>
#include<stack>
#include<queue>
#include<algorithm>
#include<set>
#include<map>
using namespace std;
int main()
{
    int tp,q,val;
    string key;
    map<string,int> mp;
    cin>>q;
    while(q--){
        cin>>tp;
        if(tp==1)
        {
            cin>>key;
            cout<<mp[key]<<"\n";
        }
        else if(tp==0){
            cin>>key>>val;
            mp[key]=val;
        }
        else if(tp==2){
            cin>>key;
            mp.erase(key);
        }
    }

}



