#include<bits/stdc++.h>

using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)

typedef long long ll;
typedef pair<int, int> P;

#define MAX 100005
#define INF 1001001001

int main(int, char**)
{
  map<string, int> a;
  int q;
  cin >> q;
  vector<int> ans;
  rep(i,q) {
    int command; cin >> command;
    if (command == 0) {
      string key;
      int x;
       cin >> key >> x;
      a[key] = x;
    } else if (command == 1) {
      string key; cin >> key;
      ans.push_back(a[key]);
    } else if (command == 2) {
      string key; cin >> key;
      a.erase(key);
    }
  }

  for (auto a : ans) cout << a << endl;

  return 0;
}

