#include<bits/stdc++.h>
#define io ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
int n;
struct stu {
string name;
int score;
};
vector<stu> studentt;
map<string, pair<bool, int>> f;
int countt = 0;
int main() {
io
cin >> n;
while (n--) {
int x;
cin >> x;
string s;
if (x != 4) cin >> s;
if (x == 1) {
countt++;
int u;
cin >> u;
if (f[s].first)
studentt[f[s].second].score = u;
else {
f[s].first = 1;
f[s].second = studentt.size();
studentt.push_back({s, u});
}
cout << "OK";
} else if (x == 2) {
if (f[s].first) cout << studentt[f[s].second].score;
else cout << "Not found";
} else if (x == 3) {
if (f[s].first) {
countt--;
f[s].first = 0;
cout << "Deleted successfully";
} else cout << "Not found";
} else cout << countt;
cout << "\n";
}
return 0;
}