#include <iostream>
#include <string>

using namespace std;

void SetupEmptyStaff(int n, char staff[][1400])
{
	static char clef[11][11] = {
		"----|-\\---",
		"    |  }  ",
		"----|-/---",
		"    |/   4",
		"---/|-----",
		"  / |    4",
		"-{--|-\\---",
		"  \\_|_/   ",
		"----|\\----",
		"    |_}   ",
		"          "
	};
	static char lines[11] = {'-', ' ', '-', ' ', '-', ' ', '-', ' ', '-', ' ', ' '};
	for (int i = 0; i < 11; i++)
		strcpy(staff[i], clef[i]);

	int lineLength = 15 + n * 5;
	for (int i = 0; i < 11; i++)
	{
		memset(staff[i] + 10, lines[i], lineLength - 10 - 1);
		staff[i][lineLength] = 0;
		staff[i][lineLength - 1] = '|';
	}
	staff[0][lineLength - 1] = '+';
	staff[8][lineLength - 1] = '+';
	staff[9][lineLength - 1] = ' ';
	staff[10][lineLength - 1] = ' ';
}

void AddNote(char staff[][1400], int line, int col)
{
	col -= 1;
	staff[line][col - 1] = '(';
	staff[line][col] = '@';
	staff[line][col + 1] = ')';
	for (int i = 0; i < 3; i++)
	{
		if (line >= 5)
			staff[line - i - 1][col + 1] = '|';
		else
			staff[line + i + 1][col - 1] = '|';
	}
}

void AddSharp(char staff[][1400], int line, int col)
{
	col -= 1;
	staff[line][col - 2] = '#';
}

void AddNote(char staff[][1400], string &note, int i)
{
	switch (note[0])
	{
	case 'C':
		if (note[1] == '2')
		{
			AddNote(staff, 3, i * 5 + 15);
			if (note[2] == '#')
				AddSharp(staff, 3, i * 5 + 15);
		}
		else
		{
			AddNote(staff, 10, i * 5 + 15);
			if (note[1] == '#')
				AddSharp(staff, 10, i * 5 + 15);
		}
		break;
	case 'D':
		AddNote(staff, 9, i * 5 + 15);
		if (note[1] == '#')
			AddSharp(staff, 9, i * 5 + 15);
		break;
	case 'E':
		AddNote(staff, 8, i * 5 + 15);
		break;
	case 'F':
		AddNote(staff, 7, i * 5 + 15);
		if (note[1] == '#')
			AddSharp(staff, 7, i * 5 + 15);
		break;
	case 'G':
		AddNote(staff, 6, i * 5 + 15);
		if (note[1] == '#')
			AddSharp(staff, 6, i * 5 + 15);
		break;
	case 'A':
		AddNote(staff, 5, i * 5 + 15);
		if (note[1] == '#')
			AddSharp(staff, 5, i * 5 + 15);
		break;
	case 'B':
		AddNote(staff, 4, i * 5 + 15);
		break;
	}
}

int main()
{
	char staff[11][1400];

	int n;
	cin >> n;

	SetupEmptyStaff(n, staff);
	for (int i = 0; i < n; i++)
	{
		string note;
		cin >> note;
		AddNote(staff, note, i);
	}
	
	for (int i = 0; i < 11; i++)
	{
		cout << staff[i] << endl;
	}
	return 0;
}