#include<algorithm>
#include<bitset>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<ctime>
#include<deque>
#include<fstream>
#include<iomanip>
#include<iostream>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<vector>

using namespace std;

#define dbg(x) (cout<<#x<<" = "<<(x)<<'\n')
#ifdef HOME
const string inputFile = "input.txt";
const string outputFile = "output.txt";
#else
const string problemName = "";
const string inputFile = problemName + ".in";
const string outputFile = problemName + ".out";
#endif

typedef long long int lld;
typedef pair<int, int> PII;
typedef pair<int, lld> PIL;
typedef pair<lld, int> PLI;
typedef pair<lld, lld> PLL;

const int INF = (1LL << 31) - 1;
const lld LINF = (1LL << 62) - 1;
const int dx[] = {1, 0, -1, 0, 1, -1, 1, -1};
const int dy[] = {0, 1, 0, -1, 1, -1, -1, 1};
const int MOD = (int)(1e9) + 7;

const int NMAX = 100000 + 5;
const int MMAX = 100000 + 5;
const int KMAX = 100000 + 5;
const int PMAX = 100000 + 5;
const int LMAX = 100000 + 5;
const int VMAX = 100000 + 5;

int N;
char S[20][350];

int guess(char a) {
    if(a == 'C')
        return 0;
    if(a == 'D')
        return 1;
    if(a == 'E')
        return 2;
    if(a == 'F')
        return 3;
    if(a == 'G')
        return 4;
    if(a == 'A')
        return 5;
    if(a == 'B')
        return 6;
}

void pune(int poz, int nota, int diez) {
    int arond, st, dr, bara, lo, hi, i;

    if(nota == 0) {
        arond = 10;
        st = poz - 1;
        dr = poz + 1;
        bara = st;
        lo = arond - 1;
        hi = arond - 3;
    } else if(nota == 1) {
        arond = 9;
        st = poz - 1;
        dr = poz + 1;
        bara = st;
        lo = arond - 1;
        hi = arond - 3;
    } else if(nota == 2) {
        arond = 8;
        st = poz - 1;
        dr = poz + 1;
        bara = st;
        lo = arond - 1;
        hi = arond - 3;
    } else if(nota == 3) {
        arond = 7;
        st = poz - 1;
        dr = poz + 1;
        bara = st;
        lo = arond - 1;
        hi = arond - 3;
    } else if(nota == 4) {
        arond = 6;
        st = poz - 1;
        dr = poz + 1;
        bara = st;
        lo = arond - 1;
        hi = arond - 3;
    } else if(nota == 5) {
        arond = 5;
        st = poz - 1;
        dr = poz + 1;
        bara = st;
        lo = arond - 1;
        hi = arond - 3;
    } else if(nota == 6) {
        arond = 4;
        st = poz - 1;
        dr = poz + 1;
        bara = dr;
        lo = arond + 1;
        hi = arond + 3;
    } else if(nota == 7) {
        arond = 3;
        st = poz - 1;
        dr = poz + 1;
        bara = dr;
        lo = arond + 1;
        hi = arond + 3;
    }

    if(diez)
        diez = st - 1;

    if(bara == st)
        bara = dr;
    else
        bara = st;

    S[arond][poz] = '@';
    S[arond][st] = '(';
    S[arond][dr] = ')';
    if(diez)
        S[arond][diez] = '#';

    for(i = min(lo, hi); i <= max(lo, hi); i++)
        S[i][bara] = '|';
}

int main() {
    int i, j, note, hashtag;
    char a, b;
    char W[20];

#ifndef ONLINE_JUDGE
    freopen(inputFile.c_str(), "r", stdin);
    freopen(outputFile.c_str(), "w", stdout);
#endif

    scanf("%d", &N);

    strcpy(S[0] + 1, "----|-\\---");
    strcpy(S[1] + 1, "    |  }  ");
    strcpy(S[2] + 1, "----|-/---");
    strcpy(S[3] + 1, "    |/   4");
    strcpy(S[4] + 1, "---/|-----");
    strcpy(S[5] + 1, "  / |    4");
    strcpy(S[6] + 1, "-{--|-\\---");
    strcpy(S[7] + 1, "  \\_|_/   ");
    strcpy(S[8] + 1, "----|\\----");
    strcpy(S[9] + 1, "    |_}   ");
    strcpy(S[10] + 1, "          ");

    for(i = 11; i <= 300; i++) {
        S[0][i] = S[2][i] = S[4][i] = S[6][i] = S[8][i] = '-';
        S[1][i] = S[3][i] = S[5][i] = S[7][i] = S[9][i] = S[10][i] = ' ';
    }

    for(i = 1, j = 15; i <= N; i++, j += 5) {
        scanf("%s", W);

        hashtag = 0;

        a = W[0];

        if(strlen(W) > 1)
            b = W[1];
        else
            b = 0;

        if(b == '2' && strlen(W) > 2)
            hashtag = 1;
        else if(b == '#')
            hashtag = 1;

        if(b == '2')
            note = 7;
        else
            note = guess(a);

        pune(j, note, hashtag);
    }

    for(i = 0; i <= 10; i++)
        S[i][j + 1] = 0, S[i][j] = '|';
    S[0][j] = S[8][j] = '+';
    S[9][j] = S[10][j] = 0;

    for(i = 0; i <= 10; i++)
        printf("%s\n", S[i] + 1);

    return 0;
}