//  [cpp]
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;

#define REP(i,x) for(int i=0;i<(int)(x);i++)
#define REPS(i,x) for(int i=1;i<=(int)(x);i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RREPS(i,x) for(int i=((int)(x));i>0;i--)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();i++)
#define ALL(container) (container).begin(), (container).end()
#define RALL(container) (container).rbegin(), (container).rend()
#define mp(a,b) make_pair(a, b)
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define __builtin_popcount __builtin_popcountll
//#define endl '\n'

template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
template<class T> ostream& operator<<(ostream &os, const vector<T> &t) {
    os<<"["; FOR(it,t) {if(it!=t.begin()) os<<","; os<<*it;} os<<"]"; return os;
}
template<class T> ostream& operator<<(ostream &os, const set<T> &t) {
    os<<"{"; FOR(it,t) {if(it!=t.begin()) os<<","; os<<*it;} os<<"}"; return os;
}
template<class S, class T> ostream& operator<<(ostream &os, const map<S, T> &t) {
    os<<"{"; FOR(it,t) {if(it!=t.begin()) os<<","; os<<*it;} os<<"}"; return os;
}
template<class S, class T> ostream& operator<<(ostream &os, const pair<S,T> &t) { return os<<"("<<t.first<<","<<t.second<<")";}
template<class S, class T> pair<S,T> operator+(const pair<S,T> &s, const pair<S,T> &t){ return pair<S,T>(s.first+t.first, s.second+t.second);}
template<class S, class T> pair<S,T> operator-(const pair<S,T> &s, const pair<S,T> &t){ return pair<S,T>(s.first-t.first, s.second-t.second);}


int T, n, m;

const vector<string> code;

int main(int argc, char *argv[]) {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    string s;
    cin >> n >> s;
    const vector<string> code({
        ".,a:a,",
        ".,b:b,",
        ".,c:c,",
        ".,d:d,",
        ".,e:e,",
        ".,f:f,",
        ".,g:g,",
        ".,h:h,",
        ".,i:i,",
        ".,j:j,",
        ".,k:k,",
        ".,l:l,",
        ".,m:m,",
        ".,n:n,",
        ".,o:o,",
        ".,p:p,",
        ".,q:q,",
        ".,r:r,",
        ".,s:s,",
        ".,t:t,",
        ".,u:u,",
        ".,v:v,",
        ".,w:w,",
        ".,x:x,",
        ".,y:y,",
        ".,z:z,",
        ".a:a.",
        ".b:b.",
        ".c:c.",
        ".d:d.",
        ".e:e.",
        ".f:f.",
        ".g:g.",
        ".h:h.",
        ".i:i.",
        ".j:j.",
        ".k:k.",
        ".l:l.",
        ".m:m.",
        ".n:n.",
        ".o:o.",
        ".p:p.",
        ".q:q.",
        ".r:r.",
        ".s:s.",
        ".t:t.",
        ".u:u.",
        ".v:v.",
        ".w:w.",
        ".x:x.",
        ".y:y.",
        ".z:z.",
        ",a:,,",
        ",b:,,",
        ",c:,,",
        ",d:,,",
        ",e:,,",
        ",f:,,",
        ",g:,,",
        ",h:,,",
        ",i:,,",
        ",j:,,",
        ",k:,,",
        ",l:,,",
        ",m:,,",
        ",n:,,",
        ",o:,,",
        ",p:,,",
        ",q:,,",
        ",r:,,",
        ",s:,,",
        ",t:,,",
        ",u:,,",
        ",v:,,",
        ",w:,,",
        ",x:,,",
        ",y:,,",
        ",z:,,",
        ".,:,",
        ",,,:,,",
        ",,::...",
        ",::",
        ":" + string(n, '.') + ","
    });
    vector<tuple<string, string, bool>> program;
    for (const string &l : code) {
        const long long int c = l.find(':', 0);
        if (l[c + 1] == ':') {
            program.emplace_back(l.substr(0, c), l.substr(c + 2), true);
        } else {
            program.emplace_back(l.substr(0, c), l.substr(c + 1), false);
        }
    }

    while (true) {
        bool end = true;
        for (const auto &op : program) {
            string src, dst;
            bool term;
            tie(src, dst, term) = op;
            int p = s.find(src, 0);
            if (p != string::npos) {
                s = s.substr(0, p) + dst + s.substr(p + src.size());
                end = term;
                break;
            }
        }
        if (end) break;
    }

    cout << s << endl;
    return 0;
}