#include <bits/stdc++.h>
#define r(i,n) for(int i = 0; i<n; i++)
using namespace std;
 
int main() {
  int q;
  map<string,int>m;
  cin >> q;
  while(q--){
    int x, y;
    string key;
    cin >> x >> key;
    if(!x){
      cin >> y;
      m[key]=y;
    }
    else if(x==1){
      cout << m[key] << endl;
    }
    else{
      m.erase(key);
    }
  }
}
