#include <iostream>
#include <string>
#include <unordered_map>
using namespace std;

int main() {
	int q;
	cin >> q;
	unordered_map<string, int> M;
	for (int i = 0; i < q; ++i) {
		int query;
		string key;
		cin >> query >> key;
		if (query == 0) {
			int x;
			cin >> x;
			M[key] = x;
		}
		else if (query == 1) cout << M[key] << endl;
		else M.erase(key);
	}
}
