#include <iostream>
#include <map>
#include <string>

int main(int argc, char *argv[]) {
  int q;
  std::cin >> q;
  std::map<std::string, long> m;
  for (int i = 0; i < q; ++i) {
    int c;
    std::string key;
    std::cin >> c >> key;
    switch (c) {
    case 0:
      int x;
      std::cin >> x;
      m[key] = x;
      break;
    case 1:
      if (m.find(key) != m.end())
        std::cout << m.at(key) << std::endl;
      else
        std::cout << 0 << std::endl;
      break;
    case 2:
      m.erase(key);
      break;
    }
  }
}

