from re import L
N = int(input())
def countYut(string):
yut = [5,1,2,3,4]
count = 0
for s in string:
if s=='F':
count += 1
return yut[count]
def sameTeam(a):
if a in 'abcd':
return 'abcd'
else:
return 'ABCD'
def otherTeam(a):
if a in 'abcd':
return 'ABCD'
else:
return 'abcd'
course = [
[23,24,25,20], # course 1
[10,26,27,23,24,25,20], # course 2
[5,21,22,23,28,29]+list(range(15,21)), # course 3
list(range(21)), # course 4
]
status = {k: [0,3] for k in "ABCDabcd"} # pose, course
for _ in range(N):
horse, yut_ = input().split()
count = countYut(yut_)
cur_pose, cur_course = status[horse]
for idx,p in enumerate(course[cur_course]):
if p == cur_pose:
break
if idx+count >= len(course[cur_course]):
# finish
next_pose = 30
next_course = 4
else:
next_pose = course[cur_course][idx+count]
# course 변경
if next_pose == 5:
next_course = 2
elif next_pose == 10:
next_course = 1
elif next_pose == 23:
next_course = 0
else:
next_course = cur_course
# 말 잡기
for oppo in otherTeam(horse):
if status[oppo][0] == next_pose and status[oppo][1] != 4:
status[oppo][0] = 0
status[oppo][1] = 3
status[horse][0] = next_pose
status[horse][1] = next_course
# 말 업기
for mate in sameTeam(horse):
if status[mate][0] == cur_pose and cur_pose != 0:
status[mate][0] = next_pose
status[mate][1] = next_course
# Print map
board_str = """
..----..----..----..----..----..
.. .. .. .. .. ..
| \ / |
| \ / |
| \ / |
| .. .. |
.. .. .. ..
.. \ / ..
| \ / |
| \ / |
| .. .. |
| .. .. |
.. \ / ..
.. \ / ..
| \ / |
| .. |
| .. |
| / \ |
.. / \ ..
.. / \ ..
| .. .. |
| .. .. |
| / \ |
| / \ |
.. / \ ..
.. .. .. ..
| .. .. |
| / \ |
| / \ |
| / \ |
.. .. .. .. .. ..
..----..----..----..----..----..
"""
board = []
for line in board_str.strip().split('\n'):
board.append([c for c in line])
pose_table = [
[-1,-1],
[24,30],[18,30],[12,30],[6,30],[0,30], # 1~5
[0,24],[0,18],[0,12],[0,6],[0,0], # 6~10
[6,0],[12,0],[18,0],[24,0],[30,0], # 11~15
[30,6],[30,12],[30,18],[30,24],[30,30], # 16~20
[5,25],[10,20],[15,15], # 21~23
[20,20],[25,25], # 24~25
[5,5],[10,10], # 26~27
[20,10],[25,5], # 28~29
]
for horse, [dx,dy] in zip('abcd',[[0,0],[0,1],[1,0],[1,1]]):
horses = [horse, horse.upper()]
for h in horses:
if status[h][0] != 0 and status[h][0] != 30:
x,y = pose_table[status[h][0]]
x += dx
y += dy
board[x][y] = h
for line in board:
print(*line,sep='')