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

using namespace std;

int main() {
	map<string, int> M;
	int q;
	cin >> q;
	int query, x;
	string key;
	map<string, int>::iterator itr;

	for (int i = 0; i < q; i++) {
		cin >> query >> key;
		if (query == 0) {
			cin >> x;
			itr = M.find(key);

			if (itr == M.end())
				M.insert(make_pair(key, x));
			else
				M[key] = x;
		}
		else if(query == 1){
			cout << M[key] << endl;
		}	
		else {
			M.erase(key);
		}
	}
}
