#include <bits/stdc++.h>

using namespace std;

int main() 
{
    int n, x, z, i;
    string y;
    cin >> n;
    
    map<string, int> m;
    
    for(i = 0; i < n; i++)
    {
        cin >> x >> y;
        
        if(x == 0)
        {
            cin >> z;
            m[y] = z;
        }
        else if(x == 1)
        {
            printf("%d\n", m[y]);
        }
        else if(x == 2)
        {
            m[y] = 0;
        }
    }
    
    return 0;
}
