#с списков так с списков
N = int(input())
a, b, c = input(), input(), input()
arr = [['' for j in range(N)] for i in range(N)]
for i in range(N):
for j in range(N):
if i == j:
arr[i][j] = a
elif j > i:
arr[i][j] = b
else:
arr[i][j] = c
print(arr[i][j], sep='', end='')
print()
#с списков так с списков
N = int(input())
a, b, c = input(), input(), input()
arr = [['' for j in range(N)] for i in range(N)]
for i in range(N):
for j in range(N):
if i == j:
arr[i][j] = a
elif j > i:
arr[i][j] = b
else:
arr[i][j] = c
print(arr[i][j], sep='', end='')
print()