#include<iostream>
#include<map>
#include<string>
using namespace std;
int main()
{
  int q,n,order;
  string s;
  cin>>q;
  map<string,int>m;
  while(q--){

    cin>>order;
    switch(order){

    case 0:
                cin>>s>>n;
                m[s]=n;
                break;
    case 1:
                cin>>s;
                cout<<m[s]<<endl;
                break;
    case 2:
                cin>>s;
                m.erase(s);
                break;

    }
  }
  return 0;
}
