#include<bits/stdc++.h>
////#include "cmake-build-debug/Car.h"
using namespace std;
#define endl '\n'
#define ll long long
const int N = 2e5 + 5 ;
void fast() {
std::ios_base::sync_with_stdio(0);
cin.tie(NULL);
#ifndef ONLINE_JUDGE
freopen("Input.txt", "r", stdin);
freopen("Output.txt", "w", stdout);
#endif
}
ll gcd(ll a, ll b) {
return b == 0 ? a : gcd(b, a % b);
}
int lcm(int a, int b) {
return a / gcd(a, b) * b;
}
int main() {
fast() ;
int t;
cin>>t ;
map<string,int>mp ;
// map<string , vector<int>>reg ;
while (t--)
{
string x ;
cin>>x ;
if (mp[x] == 0 )
{
cout << "ok\n" ;
mp[x] ++ ;
}
else {
for (int i=1 ;i <=20 ;i++)
{
string temp = x ;
string cur = to_string (i) ;
temp += cur ;
if (mp[temp] == 0 )
{
cout << temp << endl ;
mp[temp]++;
break ;
}
}
}
}
return 0 ;
}
Copy