#include<iostream>
#include <map>
using namespace std;
map<string,int> m;
int n;
int main(){
cin>>n;
for(int i=0; i<n; i++){
int op;
string name;
cin>>op;
if(op==1){
cin>>name;
int s;
cin>>s;
m[name]=s;
cout<<"OK"<<endl;
}
else if(op==2){
cin>>name;
if(m.count(name)){
cout<<m[name];
}
else{
cout<<"Not found"<<endl;
}
}
else if(op==3){
cin>>name;
if(m.count(name)){
m.erase(name);
cout<<"Deleted successfully"<<endl;
}
else{
cout<<"Not found"<<endl;
}
}
else{
cout<<m.size()<<endl;
}
}
return 0;
}