As the boat drifts down the river, a wood full of blossoms shows up on the riverfront.

"I've been here once," Mino exclaims with delight, "it's breathtakingly amazing."

"What is it like?"

"Look, Kanno, you've got your paintbrush, and I've got my words. Have a try, shall we?" 

There are four kinds of flowers in the wood, Amaranths, Begonias, Centaureas and Dianthuses.

The wood can be represented by a rectangular grid of n rows and m columns. In each cell of the grid, there is exactly one type of flowers.

According to Mino, the numbers of connected components formed by each kind of flowers are a, b, c and d respectively. Two cells are considered in the same connected component if and only if a path exists between them that moves between cells sharing common edges and passes only through cells containing the same flowers.

You are to help Kanno depict such a grid of flowers, with n and m arbitrarily chosen under the constraints given below. It can be shown that at least one solution exists under the constraints of this problem.

Note that you can choose arbitrary n and m under the constraints below, they are not given in the input.

Input

The first and only line of input contains four space-separated integers a, b, c and d (1 ≤ a, b, c, d ≤ 100) — the required number of connected components of Amaranths, Begonias, Centaureas and Dianthuses, respectively.

Output

In the first line, output two space-separated integers n and m (1 ≤ n, m ≤ 50) — the number of rows and the number of columns in the grid respectively.

Then output n lines each consisting of m consecutive English letters, representing one row of the grid. Each letter should be among 'A', 'B', 'C' and 'D', representing Amaranths, Begonias, Centaureas and Dianthuses, respectively.

In case there are multiple solutions, print any. You can output each letter in either case (upper or lower).

Examples

Input

5 3 2 1


Output

4 7
DDDDDDD
DABACAD
DBABACD
DDDDDDD

Input

50 50 1 1


Output

4 50
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
ABABABABABABABABABABABABABABABABABABABABABABABABAB
BABABABABABABABABABABABABABABABABABABABABABABABABA
DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD

Input

1 6 4 5


Output

7 7
DDDDDDD
DDDBDBD
DDCDCDD
DBDADBD
DDCDCDD
DBDBDDD
DDDDDDD

Note

In the first example, each cell of Amaranths, Begonias and Centaureas forms a connected component, while all the Dianthuses form one.

<image>

Difficulty: MEDIUM_HARD
Tags: Graph algorithms

Constructive algorithms

Starter code:

Solutions:
import sys
(A, B, C, D) = map(int, sys.stdin.readline().split())
cols = 49
rows = 50
res = [['.' for i in range(cols)] for j in range(rows)]
A -= 1
B -= 1
for r in range(rows // 2):
	for c in range(cols):
		if r % 2 == 0 or c % 2 == 0:
			res[r][c] = 'A'
		elif B > 0:
			res[r][c] = 'B'
			B -= 1
		elif C > 0:
			res[r][c] = 'C'
			C -= 1
		elif D > 0:
			res[r][c] = 'D'
			D -= 1
		else:
			res[r][c] = 'A'
for r in range(rows // 2, rows):
	for c in range(cols):
		if r % 2 == 1 or c % 2 == 0:
			res[r][c] = 'B'
		elif A > 0:
			res[r][c] = 'A'
			A -= 1
		elif C > 0:
			res[r][c] = 'C'
			C -= 1
		elif D > 0:
			res[r][c] = 'D'
			D -= 1
		else:
			res[r][c] = 'B'
print(rows, cols)
print('\n'.join((''.join(r) for r in res)))


(a, b, c, d) = list(map(int, input().split()))
pole = []
for row in range(40):
	pole.append(['A'] * 50)
for row in range(10):
	pole.append(['D'] * 50)
for i in range(b):
	pole[i // 25 * 2][i % 25 * 2] = 'B'
for i in range(c):
	pole[7 + i // 25 * 2][i % 25 * 2] = 'C'
for i in range(d - 1):
	pole[14 + i // 25 * 2][i % 25 * 2] = 'D'
for i in range(a - 1):
	pole[41 + i // 25 * 2][i % 25 * 2] = 'A'
print('50 50')
for row in range(50):
	print(''.join(pole[row]))


from string import ascii_uppercase as au
c = tuple(map(lambda x: int(x) - 1, input().split()))
paint = [[str() for i in range(44)] for j in range(33)]
f = [[(x, y) for y in range(11 * i, 11 * (i + 1), 2) for x in range(0, 33, 2)] for i in range(4)]
for (i, mas) in enumerate(f):
	for el in mas[:c[(i + 2) % 4]]:
		(X, Y) = el
		paint[X][Y] = au[(i + 2) % 4]
for k in range(4):
	for i in range(33):
		for j in range(11 * k, 11 * (k + 1)):
			if paint[i][j] == str():
				paint[i][j] = au[k]
print(33, 44)
print('\n'.join((''.join(p) for p in paint)))


(a, b, c, d) = list(map(int, input().strip().split()))
arr = [0] * 48
for (i, ch) in enumerate(['a', 'b', 'c', 'd']):
	for row in range(12):
		ls = []
		for col in range(48):
			ls.append(ch)
		arr[i * 11 + i + row] = ls
a -= 1
b -= 1
c -= 1
d -= 1
place = {'a': 25, 'b': 36, 'c': 1, 'd': 13}
num = {'a': a, 'b': b, 'c': c, 'd': d}
for i in ['a', 'b', 'c', 'd']:
	count = 1
	while num[i] > 0:
		arr[place[i]][1 + count] = i
		count += 2
		num[i] -= 1
		if count > 45:
			place[i] += 2
			count = 1
print(48, 48)
for row in range(48):
	row_str = []
	for col in range(48):
		row_str.append(arr[row][col].upper())
	row_str = ''.join(row_str)
	print(row_str)


line = input()
flowers = line.split('\n')[0]
flowers = flowers.split(' ')
a = int(flowers[3])
ind = 3
for i in range(3):
	if int(flowers[i]) < a:
		a = int(flowers[i])
		ind = i
b = int(flowers[3])
index = (ind + 2) % 4
field = [[0 for x in range(50)] for y in range(50)]

def makerect(field, n, index):
	for i in range(50):
		for j in range(50):
			if field[i][j] == 0:
				field[i][j] = chr(n + 65)
	req = int(flowers[n]) - 1
	k = 49
	l = 1
	count = 1
	if req % 25 == 0:
		flag = 2
	else:
		flag = 0
	while req > 0:
		field[k][l] = chr(index + 65)
		req -= 1
		l = l + 2
		if l > 49 and req != 0:
			l = 1
			k = k - 2
			count += 1
	m = 48
	while m > k - 2 and int(flowers[ind]) != 1:
		count -= 1
		if count == 0 and flag != 2:
			flag = 1
		if flag == 1:
			for j in range(49):
				field[m][j] = chr(index + 65)
		else:
			for j in range(50):
				field[m][j] = chr(index + 65)
		m = m - 2
	return field

def makefield(field, flowers, ind, index):
	for k in range(4):
		if k == index:
			if int(flowers[ind]) == 1:
				a = int(flowers[k])
			else:
				a = int(flowers[k]) - 1
		else:
			a = int(flowers[k])
		j = k
		i = 0
		while a > 0:
			field[i][j] = chr(k + 65)
			j = j + 4
			a = a - 1
			if j > 49:
				i = i + 2
				j = k
	return
makefield(field, flowers, ind, index)
field = makerect(field, ind, index)
print('50 50')
for i in range(50):
	for j in range(50):
		print(field[i][j], end='')
	print()


(a, b, c, d) = map(int, input().split())
(h, m) = (50, 50)
a1 = ['A' * 25 for i in range(25)]
b1 = ['B' * 25 for i in range(25)]
c1 = ['C' * 25 for i in range(25)]
d1 = ['D' * 25 for i in range(25)]
a -= 1
b -= 1
c -= 1
d -= 1
print(50, 50)
for i in range(1, 25 - 1, 2):
	for j in range(1, 25 - 1, 2):
		if b != 0:
			b -= 1
			a1[i] = a1[i][:j] + 'B' + a1[i][j + 1:]
for i in range(1, 25 - 1, 2):
	for j in range(1, 25 - 1, 2):
		if a != 0:
			a -= 1
			b1[i] = b1[i][:j] + 'A' + b1[i][j + 1:]
for i in range(1, 25 - 1, 2):
	for j in range(1, 25 - 1, 2):
		if c != 0:
			c -= 1
			d1[i] = d1[i][:j] + 'C' + d1[i][j + 1:]
for i in range(1, 25 - 1, 2):
	for j in range(1, 25 - 1, 2):
		if d != 0:
			d -= 1
			c1[i] = c1[i][:j] + 'D' + c1[i][j + 1:]
for i in range(25):
	print(a1[i] + b1[i])
for i in range(25):
	print(c1[i] + d1[i])


from sys import stdin, stdout
(a, b, c, d) = map(int, stdin.readline().split())
sze = 50
ans = [['' for i in range(sze)] for j in range(sze)]
for i in range(sze):
	for j in range(sze):
		label = 10 * (i // 25) + 1 * (j // 25)
		if not label:
			ans[i][j] = 'A'
		elif label == 1:
			ans[i][j] = 'B'
		elif label == 10:
			ans[i][j] = 'C'
		else:
			ans[i][j] = 'D'
a -= 1
b -= 1
c -= 1
d -= 1
for i in range(sze // 2, sze, 2):
	for j in range(sze // 2, sze, 2):
		if not a:
			break
		ans[i][j] = 'A'
		a -= 1
for i in range(0, sze // 2, 2):
	for j in range(0, sze // 2, 2):
		if not d:
			break
		ans[i][j] = 'D'
		d -= 1
for i in range(sze // 2, sze, 2):
	for j in range(0, sze // 2, 2):
		if not b:
			break
		ans[i][j] = 'B'
		b -= 1
for i in range(0, sze // 2, 2):
	for j in range(sze // 2, sze, 2):
		if not c:
			break
		ans[i][j] = 'C'
		c -= 1
stdout.write(str(sze) + ' ' + str(sze) + '\n')
for i in range(sze):
	for j in range(sze):
		stdout.write(ans[i][j])
	stdout.write('\n')


J = 12
(a, b, c, d) = [int(x) for x in input().split()]
L = [[a, 'A'], [b, 'B'], [c, 'C'], [d, 'D']]
S = sorted(L, reverse=True)
S[3][0] -= 1
Rows = [[[], [], [], []]]
for i in range(0, J - 1):
	Rows += [[[], [], [], []]]
for i in range(0, J):
	for j in range(0, J):
		if S[0][0] == 0:
			for t in range(0, 4):
				Rows[i][t].extend([S[3][1]] * 4)
		elif S[1][0] == 0:
			for t in range(0, 3):
				Rows[i][t].extend([S[0][1]] * 3 + [S[3][1]])
			Rows[i][3].extend([S[3][1]] * 4)
			S[0][0] -= 1
		elif S[2][0] == 0:
			for t in range(0, 2):
				Rows[i][t].extend([S[0][1]] * 3 + [S[3][1]])
			Rows[i][2].extend([S[1][1]] * 3 + [S[3][1]])
			Rows[i][3].extend([S[3][1]] * 4)
			S[0][0] -= 1
			S[1][0] -= 1
		elif S[3][0] == 0:
			Rows[i][0].extend([S[0][1]] * 3 + [S[3][1]])
			Rows[i][1].extend([S[1][1]] * 3 + [S[3][1]])
			Rows[i][2].extend([S[2][1]] * 3 + [S[3][1]])
			Rows[i][3].extend([S[3][1]] * 4)
			S[0][0] -= 1
			S[1][0] -= 1
			S[2][0] -= 1
		else:
			Rows[i][0].extend([S[0][1]] * 3 + [S[3][1]])
			Rows[i][1].extend([S[0][1], S[3][1], S[1][1], S[3][1]])
			Rows[i][2].extend([S[0][1], S[0][1], S[2][1], S[3][1]])
			Rows[i][3].extend([S[3][1]] * 4)
			S[0][0] -= 1
			S[1][0] -= 1
			S[2][0] -= 1
			S[3][0] -= 1
print(48, 48)
for k in Rows:
	for t in range(0, 4):
		print(''.join(k[t]))


import sys
(A, B, C, D) = map(int, input().split())
board = [['A'] * 50 for i in range(33)]
for i in range(24, 33):
	for j in range(50):
		board[i][j] = 'B'
A -= 1
for i in range(1, 24, 2):
	for j in range(1, 50, 2):
		if B > 1:
			board[i][j] = 'B'
			B -= 1
		elif C > 0:
			board[i][j] = 'C'
			C -= 1
		elif D > 0:
			board[i][j] = 'D'
			D -= 1
board[23][49] = 'B'
for i in range(25, 33, 2):
	for j in range(1, 50, 2):
		if A > 0:
			board[i][j] = 'A'
			A -= 1
sys.stdout.write('33 50\n')
for i in range(33):
	sys.stdout.write(''.join(board[i]))
	if i != 32:
		sys.stdout.write('\n')


(a, b, c, d) = map(int, input().split())
(r, s) = (48, 50)
m = []
for i in ['A', 'B', 'C', 'D']:
	for j in range(r // 4):
		m.append([i for j in range(s)])
for it in range(a - 1):
	x = 2 * r // 4 + 1 + 2 * (it // 24)
	y = 1 + 2 * (it % 24)
	m[x][y] = 'A'
for it in range(b - 1):
	x = 3 * r // 4 + 1 + 2 * (it // 24)
	y = 1 + 2 * (it % 24)
	m[x][y] = 'B'
for it in range(c - 1):
	x = 0 * r // 4 + 1 + 2 * (it // 24)
	y = 1 + 2 * (it % 24)
	m[x][y] = 'C'
for it in range(d - 1):
	x = 1 * r // 4 + 1 + 2 * (it // 24)
	y = 1 + 2 * (it % 24)
	m[x][y] = 'D'
print(r, s)
for i in range(r):
	print(''.join(m[i]))


quotas = [int(x) - 1 for x in input().split()]
grid = [['a'] * 50 for _ in range(12)] + [['b'] * 50 for _ in range(12)] + [['c'] * 50 for _ in range(12)] + [['d'] * 50 for _ in range(12)]

def poke(row, f_idx):
	for i in range(row + 1, row + 12, 2):
		for j in range(1, 50, 2):
			if quotas[f_idx] > 0:
				grid[i][j] = chr(ord('a') + f_idx)
				quotas[f_idx] -= 1
poke(0, 3)
poke(12, 2)
poke(24, 1)
poke(36, 0)
print('48 50')
print('\n'.join([''.join(row) for row in grid]))


FIFTY = 50
TWENTY_FIVE = 25
TWELVE = 12
grid = [['X' for _ in range(FIFTY)] for _ in range(FIFTY)]

def construct(n, mark, bg, base_i, base_j):
	for i in range(TWENTY_FIVE):
		for j in range(TWENTY_FIVE):
			grid[base_i + i][base_j + j] = bg
	for i in range(n):
		grid[base_i + 2 * (i // TWELVE) + 1][base_j + 2 * (i % TWELVE) + 1] = mark

def main():
	(a, b, c, d) = map(int, input().split())
	construct(a - 1, 'A', 'B', 0, 0)
	construct(b - 1, 'B', 'C', TWENTY_FIVE, 0)
	construct(c - 1, 'C', 'D', 0, TWENTY_FIVE)
	construct(d - 1, 'D', 'A', TWENTY_FIVE, TWENTY_FIVE)
	print(FIFTY, FIFTY)
	for row in grid:
		print(''.join(row))
main()


import sys
(a, b, c, d) = map(int, sys.stdin.readline().split())
g = [['' for i in range(50)] for j in range(50)]
for i in range(50):
	for j in range(50):
		if i < 25 and j < 25:
			g[i][j] = 'A'
		elif i >= 25 and j < 25:
			g[i][j] = 'B'
		elif i < 25 and j >= 25:
			g[i][j] = 'C'
		else:
			g[i][j] = 'D'
for i in range(50):
	for j in range(50):
		if a > 1:
			if 0 < i < 49 and 0 < j < 49:
				if any((all((g[i + di][j + dj] == ch for di in range(-1, 2) for dj in range(-1, 2))) for ch in 'BCD')):
					g[i][j] = 'A'
					a -= 1
for i in range(50):
	for j in range(50):
		if b > 1:
			if 0 < i < 49 and 0 < j < 49:
				if any((all((g[i + di][j + dj] == ch for di in range(-1, 2) for dj in range(-1, 2))) for ch in 'ACD')):
					g[i][j] = 'B'
					b -= 1
for i in range(50):
	for j in range(50):
		if c > 1:
			if 0 < i < 49 and 0 < j < 49:
				if any((all((g[i + di][j + dj] == ch for di in range(-1, 2) for dj in range(-1, 2))) for ch in 'ABD')):
					g[i][j] = 'C'
					c -= 1
for i in range(50):
	for j in range(50):
		if d > 1:
			if 0 < i < 49 and 0 < j < 49:
				if any((all((g[i + di][j + dj] == ch for di in range(-1, 2) for dj in range(-1, 2))) for ch in 'ABC')):
					g[i][j] = 'D'
					d -= 1
print('50 50')
for row in g:
	print(''.join(row))


(a, b, c, d) = [int(i) - 1 for i in input().split()]
grid = [['X' for i in range(40)] for j in range(40)]

def fillgrid(n, color, background, xoffset, yoffset):
	(y, x) = divmod(n, 10)
	for j in range(0, 2 * y, 2):
		for i in range(0, 20, 2):
			grid[xoffset + i][yoffset + j] = color
	for i in range(0, 2 * x, 2):
		grid[xoffset + i][yoffset + 2 * y] = color

def drawframe():
	for i in range(20):
		for j in range(20):
			grid[i][j] = 'B'
	for i in range(20, 40):
		for j in range(20):
			grid[i][j] = 'C'
	for i in range(20):
		for j in range(20, 40):
			grid[i][j] = 'D'
	for i in range(20, 40):
		for j in range(20, 40):
			grid[i][j] = 'A'

def main():
	drawframe()
	fillgrid(a, 'A', 'B', 0, 0)
	fillgrid(b, 'B', 'C', 21, 0)
	fillgrid(c, 'C', 'D', 0, 21)
	fillgrid(d, 'D', 'A', 21, 21)
	print(40, 40)
	for line in grid:
		print(''.join(line))
main()


(a, b, c, d) = map(int, input().split())
if a + b + c + d == 4:
	print(1, 4)
	print('ABCD')
else:
	print(50, 50)
	ans = [[''] * 50 for i in range(50)]
	if a == 1:
		for i in range(50):
			for j in range(50):
				ans[i][j] = 'A'
		for i in range(0, 50, 2):
			for j in range(0, 50, 2):
				b -= 1
				ans[i][j] = 'B'
				if b == 0:
					break
			if b == 0:
				break
		for i in range(15, 50, 2):
			for j in range(0, 50, 2):
				c -= 1
				ans[i][j] = 'C'
				if c == 0:
					break
			if c == 0:
				break
		for i in range(30, 50, 2):
			for j in range(0, 50, 2):
				d -= 1
				ans[i][j] = 'D'
				if d == 0:
					break
			if d == 0:
				break
	elif b == 1:
		for i in range(50):
			for j in range(50):
				ans[i][j] = 'B'
		for i in range(0, 50, 2):
			for j in range(0, 50, 2):
				a -= 1
				ans[i][j] = 'a'
				if a == 0:
					break
			if a == 0:
				break
		for i in range(15, 50, 2):
			for j in range(0, 50, 2):
				c -= 1
				ans[i][j] = 'C'
				if c == 0:
					break
			if c == 0:
				break
		for i in range(30, 50, 2):
			for j in range(0, 50, 2):
				d -= 1
				ans[i][j] = 'D'
				if d == 0:
					break
			if d == 0:
				break
	else:
		b -= 1
		a -= 1
		for i in range(50):
			for j in range(50):
				ans[i][j] = 'A'
		for i in range(0, 50, 2):
			for j in range(0, 50, 2):
				b -= 1
				ans[i][j] = 'B'
				if b == 0:
					break
			if b == 0:
				break
		for i in range(12, 50, 2):
			for j in range(0, 50, 2):
				c -= 1
				ans[i][j] = 'C'
				if c == 0:
					break
			if c == 0:
				break
		for i in range(24, 50, 2):
			for j in range(0, 50, 2):
				d -= 1
				ans[i][j] = 'D'
				if d == 0:
					break
			if d == 0:
				break
		for i in range(35, 50):
			for j in range(50):
				ans[i][j] = 'B'
		for i in range(37, 50, 2):
			for j in range(0, 50, 2):
				a -= 1
				ans[i][j] = 'A'
				if a == 0:
					break
			if a == 0:
				break
	for i in range(50):
		for j in range(50):
			print(ans[i][j], end='')
		print()


(a, b, c, d) = [int(i) for i in input().split()]
ans = []
size = 25
one = list('A' * size + 'B' * size)
two = list('C' * size + 'D' * size)
for i in range(size):
	ans.append(one[:])
for i in range(size):
	ans.append(two[:])
ai = size
aj = size
bi = size
bj = 0
ci = 0
cj = size
di = 0
dj = 0
ac = 1
bc = 1
cc = 1
dc = 1
for i in range(a - 1):
	ans[ai][aj] = 'A'
	if i % (size // 2) == 0 and i != 0:
		ai += 2
		aj = size
	else:
		aj += 2
for i in range(b - 1):
	ans[bi][bj] = 'B'
	if i % (size // 2) == 0 and i != 0:
		bi += 2
		bj = 0
	else:
		bj += 2
for i in range(c - 1):
	ans[ci][cj] = 'C'
	if i % (size // 2) == 0 and i != 0:
		ci += 2
		cj = size
	else:
		cj += 2
for i in range(d - 1):
	ans[di][dj] = 'D'
	if i % (size // 2) == 0 and i != 0:
		di += 2
		dj = 0
	else:
		dj += 2
print('50 50')
for i in ans:
	print(''.join(i))


f = [int(x) for x in input().split()]
f = f[1:] + [f[0]]
l = ['A', 'B', 'C', 'D']
grid = []
for x in l:
	for _ in range(11):
		grid.append(list(x * 50))
for (i, x) in enumerate(f):
	p = 1 + i * 11
	q = 1
	h = 0
	for _ in range(x - 1):
		grid[p][q + h] = l[(i + 1) % 4]
		if q + h >= 47:
			p += 2
			q = 1
			h = 1 - h
		else:
			q += 2
print(len(grid), 50)
grid = [''.join(x) for x in grid]
print('\n'.join(grid))


(a, b, c, d) = [int(i) for i in input().split()]
m = [['A'] * 50 for i in range(50)]
a -= 1
b -= 1
while b:
	for i in range(1, 50, 2):
		for j in range(1, 50, 2):
			if b and m[i][j] == 'A':
				m[i][j] = 'B'
				b -= 1
while c:
	for i in range(1, 50, 2):
		for j in range(1, 50, 2):
			if c and m[i][j] == 'A':
				m[i][j] = 'C'
				c -= 1
while d:
	for i in range(1, 50, 2):
		for j in range(1, 50, 2):
			if d and m[i][j] == 'A':
				m[i][j] = 'D'
				d -= 1
for i in range(42, 50):
	for j in range(50):
		m[i][j] = 'B'
while a:
	for i in range(43, 50, 2):
		for j in range(1, 50, 2):
			if a and m[i][j] == 'B':
				m[i][j] = 'A'
				a -= 1
print(50, 50)
for i in range(50):
	print(*m[i], sep='')


import sys
from collections import defaultdict
(a, b, c, d) = map(int, input().split())
cnt = {'A': a, 'B': b, 'C': c, 'D': d}
n = m = 50
print(n, m)
field = [['D' for i in range(m)] for j in range(n)]
cnt['D'] -= 1
cnt['A'] -= 1
for i in range(8):
	for j in range(m):
		field[i][j] = 'A'
for i in range(0, 8, 2):
	for j in range(0, m, 2):
		if cnt['D'] > 0:
			field[i][j] = 'D'
			cnt['D'] -= 1
for i in range(10, n, 2):
	for j in range(0, m, 2):
		for letter in cnt:
			if cnt[letter] > 0:
				cnt[letter] -= 1
				field[i][j] = letter
				break
count_comps = defaultdict(int)
was = [[False for i in range(n)] for j in range(m)]

def dfs(i, j):
	was[i][j] = True
	queue = [(i, j)]
	while queue:
		(i, j) = queue[0]
		queue.pop(0)
		for (tx, ty) in [(i - 1, j), (i + 1, j), (i, j - 1), (i, j + 1)]:
			if tx >= 0 and tx < n and (ty >= 0) and (ty < m) and (not was[tx][ty]):
				if field[tx][ty] == field[i][j]:
					queue.append((tx, ty))
					was[tx][ty] = True
for i in range(n):
	for j in range(m):
		if not was[i][j]:
			dfs(i, j)
			count_comps[field[i][j]] += 1
has = list(map(lambda x: x[1], sorted(count_comps.items())))
want = [a, b, c, d]
if has != want:
	print(has)
	print(want)
	sys.exit(1)
for i in range(n):
	print(''.join(field[i]))


s = 'ABCD'
a = list(map(int, input().split()))
print(48, 50)
for k in range(4):
	print(s[k] * 50)
	cnt = 0
	for i in range(11):
		for j in range(50):
			if i % 2 == 0 and j % 2 == 1 and (cnt < a[(k + 1) % 4] - 1):
				print(s[(k + 1) % 4], end='')
				cnt = cnt + 1
			else:
				print(s[k], end='')
		print('')


(a, b, c, d) = map(int, input().split())
l = []
for i in range(10):
	l.append(['A'] * 50)
t = 0
i = 0
for j in range(b):
	l[t][i] = 'B'
	i += 2
	if i >= 50:
		t += 2
		i = 0
for i in range(10):
	l.append(['A'] * 50)
t = 10
i = 0
for j in range(c):
	l[t][i] = 'C'
	i += 2
	if i >= 50:
		t += 2
		i = 0
if a == 1:
	for i in range(10):
		l.append(['A'] * 50)
	t = 20
	i = 0
	for j in range(d):
		l[t][i] = 'D'
		i += 2
		if i >= 50:
			t += 2
			i = 0
	print(30, 50)
	r = 30
elif d == 1:
	for i in range(10):
		l.append(['A'] * 50)
	t = 20
	i = 0
	for j in range(a):
		l[t][i] = 'D'
		i += 2
		if i >= 50:
			t += 2
			i = 0
	print(30, 50)
	r = 30
	for i in range(30):
		for j in range(50):
			if l[i][j] == 'A':
				l[i][j] = 'D'
			elif l[i][j] == 'D':
				l[i][j] = 'A'
else:
	for i in range(11):
		l.append(['D'] * 50)
	t = 21
	i = 0
	for j in range(a - 2):
		l[t][i] = 'A'
		i += 2
		if i >= 50:
			t += 2
			i = 0
	print(42, 50)
	r = 42
	for i in range(11):
		l.append(['A'] * 50)
	t = 32
	i = 0
	for j in range(d - 1):
		l[t][i] = 'D'
		i += 2
		if i >= 50:
			t += 2
			i = 0
for i in range(r):
	for j in range(50):
		print(l[i][j], sep='', end='')
	print()


(a, b, c, d) = map(int, input().split())
paint = [['.' for i in range(50)] for j in range(50)]
for i in range(50):
	paint[i][12] = 'A'
	paint[i][24] = 'B'
	paint[i][25] = 'C'
	paint[i][37] = 'D'
for_a = [(x, y) for y in range(38, 50, 2) for x in range(0, 50, 2)]
for_b = [(x, y) for y in range(26, 37, 2) for x in range(0, 50, 2)]
for_c = [(x, y) for y in range(13, 24, 2) for x in range(0, 50, 2)]
for_d = [(x, y) for y in range(0, 12, 2) for x in range(0, 50, 2)]
for i in range(a - 1):
	(X, Y) = for_a[i]
	paint[X][Y] = 'A'
for i in range(b - 1):
	(X, Y) = for_b[i]
	paint[X][Y] = 'B'
for i in range(c - 1):
	(X, Y) = for_c[i]
	paint[X][Y] = 'C'
for i in range(d - 1):
	(X, Y) = for_d[i]
	paint[X][Y] = 'D'
for i in range(50):
	for j in range(12):
		if paint[i][j] == '.':
			paint[i][j] = 'A'
for i in range(50):
	for j in range(13, 24):
		if paint[i][j] == '.':
			paint[i][j] = 'B'
for i in range(50):
	for j in range(26, 37):
		if paint[i][j] == '.':
			paint[i][j] = 'C'
for i in range(50):
	for j in range(38, 50):
		if paint[i][j] == '.':
			paint[i][j] = 'D'
print(50, 50)
print('\n'.join((''.join(map(str, paint[i])) for i in range(50))))


st = input()
arr = st.split(' ')
for i in range(0, 4):
	arr[i] = int(arr[i])
arr[0] -= 1
arr[3] -= 1
it = 0
ans = list()
while 1:
	st = ''
	for j in range(0, 50):
		if it == 0:
			if arr[it] > 0:
				st += 'A'
				arr[it] -= 1
				it += 1
				continue
			it += 1
		if it == 1:
			if arr[it] > 0:
				st += 'B'
				arr[it] -= 1
				it += 1
				continue
			it += 1
		if it == 2:
			if arr[it] > 0:
				st += 'C'
				arr[it] -= 1
				it += 1
				continue
			it += 1
		if it >= 3:
			st += 'D'
			it = 0
	ans.append(st)
	st = ''
	for j in range(0, 50):
		st += 'D'
	ans.append(st)
	if arr[0] == arr[1] and arr[1] == arr[2] and (arr[2] == 0):
		st = ''
		for j in range(0, 50):
			st += 'A'
		ans.append(st)
		break
while 1:
	st = ''
	it = 0
	for j in range(0, 50):
		if it >= 1:
			if arr[3] > 0:
				st += 'D'
				arr[3] -= 1
				it = 0
				continue
			it = 0
		if it == 0:
			st += 'A'
			it += 1
			continue
	ans.append(st)
	st = ''
	for j in range(0, 50):
		st += 'A'
	ans.append(st)
	if arr[3] == 0:
		break
print(str(len(ans)) + ' 50')
for i in ans:
	print(i)


(a, b, c, d) = [int(n) for n in input().split()]
print(48, 50)
p = a - 1
for i in range(12):
	for j in range(50):
		if i % 2 == 0 and j % 2 == 0 and (p > 0):
			print('A', end='')
			p = p - 1
		else:
			print('B', end='')
	print(' ')
p = b - 1
for i in range(12):
	for j in range(50):
		if i % 2 == 1 and j % 2 == 0 and (p > 0):
			print('B', end='')
			p = p - 1
		else:
			print('A', end='')
	print(' ')
p = c - 1
for i in range(12):
	for j in range(50):
		if i % 2 == 0 and j % 2 == 0 and (p > 0):
			print('C', end='')
			p = p - 1
		else:
			print('D', end='')
	print(' ')
p = d - 1
for i in range(12):
	for j in range(50):
		if i % 2 == 1 and j % 2 == 0 and (p > 0):
			print('D', end='')
			p = p - 1
		else:
			print('C', end='')
	print(' ')


import operator
LEN = 50
HALF = 25
numbers1 = input().split(' ')
dic = {}
dic['A'] = int(numbers1[0])
dic['B'] = int(numbers1[1])
dic['C'] = int(numbers1[2])
dic['D'] = int(numbers1[3])
tmp = sorted(dic.items(), key=operator.itemgetter(1), reverse=True)
dic = dict(tmp)
sol = [[None for _ in range(LEN)] for _ in range(LEN)]
for i in range(HALF):
	for j in range(HALF):
		if i % 2 == 0 and j % 2 == 1 and (dic['D'] - 1 > 0):
			sol[i][j] = 'D'
			dic['D'] -= 1
		else:
			sol[i][j] = 'A'
for i in range(HALF):
	for j in range(HALF, LEN):
		if i % 2 == 0 and j % 2 == 1 and (dic['C'] - 1 > 0):
			sol[i][j] = 'C'
			dic['C'] -= 1
		else:
			sol[i][j] = 'B'
for i in range(HALF, LEN):
	for j in range(HALF):
		if i % 2 == 0 and j % 2 == 1 and (dic['B'] - 1 > 0):
			sol[i][j] = 'B'
			dic['B'] -= 1
		else:
			sol[i][j] = 'C'
for i in range(HALF, LEN):
	for j in range(HALF, LEN):
		if i % 2 == 0 and j % 2 == 1 and (dic['A'] - 1 > 0):
			sol[i][j] = 'A'
			dic['A'] -= 1
		else:
			sol[i][j] = 'D'
print(50, 50)
for i in range(LEN):
	for j in range(LEN):
		print(sol[i][j], end='')
	print()


__file__ = __file__.startswith('/home/a_farazei')

def input_():
	global __file__
	if not __file__:
		return input()
	if not hasattr(__file__, 'readline'):
		__file__ = open('input.txt', 'r')
	return __file__.readline()
a = list(map(int, input_().split()))

def f(t, f, tn):
	s = [[f] * 50 for _ in range(10)]
	i = 1
	while tn > 0:
		for j in range(1, 50, 2):
			s[i][j] = t
			tn -= 1
			if tn == 0:
				break
		i += 2
	return '\n'.join((''.join(x) for x in s)) + '\n'
res = ''
res += f('A', 'B', a[0] - 1)
res += f('B', 'A', a[1] - 1)
res += f('C', 'D', a[2] - 1)
res += f('D', 'C', a[3] - 1)
print('40 50')
print(res)


ans = [[i for _ in range(50)] for i in ['C', 'D', 'A', 'B'] for j in range(12)]
(a, b, c, d) = map(int, input().split())
a -= 1
b -= 1
c -= 1
d -= 1
i = j = 0
while a:
	a -= 1
	ans[i][j] = 'A'
	j += 2
	if j >= 50:
		j = 0
		i += 2
i = 12
j = 0
while b:
	b -= 1
	ans[i][j] = 'B'
	j += 2
	if j >= 50:
		j = 0
		i += 2
i = 24
j = 0
while c:
	c -= 1
	ans[i][j] = 'C'
	j += 2
	if j >= 50:
		j = 0
		i += 2
i = 36
j = 0
while d:
	d -= 1
	ans[i][j] = 'D'
	j += 2
	if j >= 50:
		j = 0
		i += 2
print('48 50')
print('\n'.join((''.join(i) for i in ans)))


num = [int(x) - 1 for x in input().split()]
mapp = [[0] * 50 for i in range(50)]
for i in range(50):
	for j in range(50):
		r = 0
		if i >= 25:
			r += 1
		c = 0
		if j >= 25:
			c += 1
		mapp[i][j] = r * 2 + c
x = 1
y = 1
for i in range(num[1]):
	mapp[x][y] = 1
	y += 2
	if y >= 24:
		x += 2
		y = 1
x = 1
y = 26
for i in range(num[0]):
	mapp[x][y] = 0
	y += 2
	if y >= 49:
		x += 2
		y = 26
x = 26
y = 1
for i in range(num[3]):
	mapp[x][y] = 3
	y += 2
	if y >= 24:
		x += 2
		y = 1
x = 26
y = 26
for i in range(num[2]):
	mapp[x][y] = 2
	y += 2
	if y >= 49:
		x += 2
		y = 26
print(50, 50)
for i in range(50):
	for j in range(50):
		print(chr(ord('A') + mapp[i][j]), end='')
	print()


(a, b, c, d) = map(int, input().split())
A = [['A'] * 50 for i in range(12)]
B = [['B'] * 50 for i in range(12)]
C = [['C'] * 50 for i in range(12)]
D = [['D'] * 50 for i in range(12)]
X = []
for i in range(12):
	for j in range(50):
		if (i + j) % 2 == 0 and i % 2 == 0:
			X.append((i, j))
for i in range(c - 1):
	(y, x) = X[i]
	A[y][x] = 'C'
for i in range(d - 1):
	(y, x) = X[i]
	B[y][x] = 'D'
for i in range(a - 1):
	(y, x) = X[i]
	C[y][x] = 'A'
for i in range(b - 1):
	(y, x) = X[i]
	D[y][x] = 'B'
print(48, 50)
for i in range(12):
	print(''.join(A[i]))
for i in range(12):
	print(''.join(B[i]))
for i in range(12):
	print(''.join(C[i]))
for i in range(12):
	print(''.join(D[i]))


L = ['A', 'B', 'C', 'D']
c = list(map(int, input().split()))
i = 0
for j in range(4):
	if c[j] < c[i]:
		i = j
gd = [[L[i]] * 50 for j in range(50)]
c[i] -= 1

def ff():
	for a in range(4):
		if a != i and c[a]:
			c[a] -= 1
			return L[a]
	return -1
for y in range(49, -1, -1):
	for x in range(1 - y % 2, 50, 2):
		if not c[i]:
			break
		c[i] -= 1
		if gd[y - 1][x] == L[i]:
			gd[y - 1][x] = ff()
		if x + 1 < 50 and gd[y][x + 1] == L[i]:
			gd[y][x + 1] = ff()
for y in range(0, 50, 2):
	for x in range(0, 50, 2):
		a = ff()
		if a != -1:
			gd[y][x] = a
print('50 50')
for y in range(50):
	print(''.join(gd[y]))


(a, b, c, d) = list(map(int, input().split()))
A = []
for row in range(40):
	A.append(['A'] * 50)
for row in range(10):
	A.append(['D'] * 50)
for i in range(b):
	A[i // 25 * 2][i % 25 * 2] = 'B'
for i in range(c):
	A[8 + i // 25 * 2][i % 25 * 2] = 'C'
for i in range(d - 1):
	A[16 + i // 25 * 2][i % 25 * 2] = 'D'
for i in range(a - 1):
	A[41 + i // 25 * 2][i % 25 * 2] = 'A'
print('50 50')
for row in range(50):
	print(''.join(A[row]))


(a, b, c, d) = map(int, input().split())
arr = [[a, 'A'], [b, 'B'], [c, 'C'], [d, 'D']]
arr.sort()
ans = ''
m = 0
if arr[0][0] == 1:
	while arr[1][0] > 25:
		ans += (arr[0][1] + arr[1][1]) * 25
		arr[1][0] -= 25
		ans += '\n'
		m += 1
		ans += arr[0][1] * 50 + '\n'
		m += 1
	ans += (arr[0][1] + arr[1][1]) * arr[1][0]
	ans += (arr[0][1] + arr[0][1]) * (25 - arr[1][0])
	ans += '\n'
	m += 1
	ans += arr[0][1] * 50 + '\n'
	m += 1
	while arr[2][0] > 25:
		ans += (arr[0][1] + arr[2][1]) * 25
		arr[2][0] -= 25
		ans += '\n'
		m += 1
		ans += arr[0][1] * 50 + '\n'
		m += 1
	ans += (arr[0][1] + arr[2][1]) * arr[2][0]
	ans += (arr[0][1] + arr[0][1]) * (25 - arr[2][0])
	ans += '\n'
	m += 1
	ans += arr[0][1] * 50 + '\n'
	m += 1
	while arr[3][0] > 25:
		ans += (arr[0][1] + arr[3][1]) * 25 + '\n'
		m += 1
		arr[3][0] -= 25
		ans += arr[0][1] * 50 + '\n'
		m += 1
	ans += (arr[0][1] + arr[3][1]) * arr[3][0]
	ans += (arr[0][1] + arr[0][1]) * (25 - arr[3][0]) + '\n'
	m += 1
	ans += arr[0][1] * 50 + '\n'
	m += 1
else:
	arr[0][0] -= 1
	arr[1][0] -= 1
	arr[2][0] -= 1
	arr[3][0] -= 1
	ans += arr[1][1] * 50 + '\n'
	m += 1
	while arr[0][0] > 25:
		ans += (arr[0][1] + arr[1][1]) * 25 + '\n'
		m += 1
		arr[0][0] -= 25
		ans += arr[1][1] * 50 + '\n'
		m += 1
	ans += (arr[0][1] + arr[1][1]) * arr[0][0]
	ans += (arr[1][1] + arr[1][1]) * (25 - arr[0][0]) + '\n'
	m += 1
	ans += arr[1][1] * 50 + '\n'
	m += 1
	ans += arr[2][1] * 50 + '\n'
	m += 1
	while arr[1][0] > 25:
		ans += (arr[1][1] + arr[2][1]) * 25 + '\n'
		m += 1
		arr[1][0] -= 25
		ans += arr[2][1] * 50 + '\n'
		m += 1
	ans += (arr[1][1] + arr[2][1]) * arr[1][0]
	ans += (arr[2][1] + arr[2][1]) * (25 - arr[1][0]) + '\n'
	m += 1
	ans += arr[2][1] * 50 + '\n'
	m += 1
	ans += arr[3][1] * 50 + '\n'
	m += 1
	while arr[2][0] > 25:
		ans += (arr[2][1] + arr[3][1]) * 25 + '\n'
		m += 1
		arr[2][0] -= 25
		ans += arr[3][1] * 50 + '\n'
		m += 1
	ans += (arr[2][1] + arr[3][1]) * arr[2][0]
	ans += (arr[3][1] + arr[3][1]) * (25 - arr[2][0]) + '\n'
	m += 1
	ans += arr[3][1] * 50 + '\n'
	m += 1
	ans += arr[0][1] * 50 + '\n'
	m += 1
	while arr[3][0] > 25:
		ans += (arr[3][1] + arr[0][1]) * 25 + '\n'
		m += 1
		arr[3][0] -= 25
		ans += arr[0][1] * 50 + '\n'
		m += 1
	ans += (arr[3][1] + arr[0][1]) * arr[3][0]
	ans += (arr[0][1] + arr[0][1]) * (25 - arr[3][0]) + '\n'
	m += 1
	ans += arr[0][1] * 50 + '\n'
	m += 1
print(m, 50)
print(ans)


import sys
input = sys.stdin.readline
(a, b, c, d) = map(int, input().split())
s = [[''] * 48 for i in range(48)]
for j in range(48):
	for i in range(12):
		s[i][j] = 'A'
	for i in range(12, 24):
		s[i][j] = 'B'
	for i in range(24, 36):
		s[i][j] = 'C'
	for i in range(36, 48):
		s[i][j] = 'D'
a -= 1
b -= 1
c -= 1
d -= 1
for i in range(12):
	for j in range(0, 48, 2):
		if c > 0 and (i + j) % 2:
			s[i][j] = 'C'
			c -= 1
for i in range(12, 24):
	for j in range(0, 48, 2):
		if d > 0 and (i + j) % 2:
			s[i][j] = 'D'
			d -= 1
for i in range(24, 36):
	for j in range(0, 48, 2):
		if a > 0 and (i + j) % 2:
			s[i][j] = 'A'
			a -= 1
for i in range(36, 48):
	for j in range(0, 48, 2):
		if b > 0 and (i + j) % 2:
			s[i][j] = 'B'
			b -= 1
print(48, 48)
for i in range(48):
	print(''.join(s[i]))


data = input()

def main():
	counters = [int(x) for x in data.split(' ')]
	codes = {0: 'A', 1: 'B', 2: 'C', 3: 'D'}
	counters[0] -= 1
	counters[3] -= 1
	completed = []
	row = []
	for flower in range(1, 4):
		(rows, row) = fill_grid(row, 'A', codes[flower], counters[flower])
		completed += rows
	if row:
		completed.append(''.join(row) + 'A' * (50 - len(row)))
		completed.append('A' * 50)
	completed.append('D' * 50)
	row = []
	(rows, row) = fill_grid(row, 'D', 'A', counters[0])
	completed += rows
	if row:
		completed.append(''.join(row) + 'D' * (50 - len(row)))
		completed.append('D' * 50)
	print('{} 50'.format(len(completed)))
	for row in completed:
		print(row)

def fill_grid(row, grid, flower, counter):
	completed = []
	while counter > 0:
		counter -= 1
		row.append(flower)
		row.append(grid)
		if len(row) == 50:
			completed.append(''.join(row))
			completed.append(''.join([grid] * 50))
			row = []
	return (completed, row)
main()


(a, b, c, d) = map(int, input().split())
r = [['A' for i in range(50)] for j in range(50)]
flag = 0
print(50, 50)
for i in range(0, 8, 2):
	for j in range(0, 50, 2):
		r[i][j] = 'D'
		d -= 1
		if d == 0:
			flag = 1
			break
	if flag == 1:
		break
flag = 0
for i in range(8, 16, 2):
	for j in range(0, 50, 2):
		r[i][j] = 'C'
		c -= 1
		if c == 0:
			flag = 1
			break
	if flag == 1:
		break
for i in range(49, 32, -1):
	for j in range(50):
		r[i][j] = 'B'
a -= 1
b -= 1
flag = 0
if a != 0:
	for i in range(34, 50, 2):
		for j in range(0, 50, 2):
			r[i][j] = 'A'
			a -= 1
			if a == 0:
				flag = 1
				break
		if flag == 1:
			break
flag = 0
if b != 0:
	for i in range(16, 50, 2):
		for j in range(0, 50, 2):
			r[i][j] = 'B'
			b -= 1
			if b == 0:
				flag = 1
				break
		if flag == 1:
			break
for i in r:
	for j in i:
		print(j, end='')
	print()


[a, b, c, d] = map(int, input().strip().split())
N = 25

def make(q, fore, back):
	fld = [[back for _ in range(N)] for __ in range(N)]
	P = N // 2
	for i in range(q):
		fld[2 * (i % P)][2 * (i // P)] = fore
	return fld
res = [['X' for _ in range(2 * N)] for j in range(2 * N)]
AB = make(a - 1, 'A', 'B')
BC = make(b - 1, 'B', 'C')
CD = make(c - 1, 'C', 'D')
DA = make(d - 1, 'D', 'A')
for i in range(N):
	for j in range(N):
		res[i][j] = AB[i][j]
		res[2 * N - i - 1][j] = BC[i][j]
		res[i][2 * N - j - 1] = CD[i][j]
		res[2 * N - i - 1][2 * N - j - 1] = DA[i][j]
print(2 * N, 2 * N)
for row in res:
	print(''.join(row))


from collections import defaultdict, deque
import sys
import bisect
input = sys.stdin.readline
(a, b, c, d) = map(int, input().split())
grid1 = [['A' for i in range(50)] for j in range(12)]
grid2 = [['B' for i in range(50)] for j in range(12)]
grid3 = [['C' for i in range(50)] for j in range(12)]
grid4 = [['D' for i in range(50)] for j in range(12)]
ok = False
for i in range(12):
	for j in range(50):
		if i & 1 and j & 1 and (b > 1):
			grid1[i][j] = 'B'
			b -= 1
			if b == 1:
				ok = True
				break
	if ok:
		break
ok = False
for i in range(12):
	for j in range(50):
		if i & 1 and j & 1 and (a > 1):
			grid2[i][j] = 'A'
			a -= 1
			if a == 1:
				ok = True
				break
	if ok:
		break
ok = False
for i in range(12):
	for j in range(50):
		if i & 1 and j & 1 and (d > 1):
			grid3[i][j] = 'D'
			d -= 1
			if d == 1:
				ok = True
				break
	if ok:
		break
ok = False
for i in range(12):
	for j in range(50):
		if i & 1 and j & 1 and (c > 1):
			grid4[i][j] = 'C'
			c -= 1
			if c == 1:
				ok = True
				break
	if ok:
		break
print(48, 50)
for i in range(12):
	print(''.join(map(str, grid1[i])))
for i in range(12):
	print(''.join(map(str, grid2[i])))
for i in range(12):
	print(''.join(map(str, grid3[i])))
for i in range(12):
	print(''.join(map(str, grid4[i])))


import math
(a, b, c, d) = list(map(int, input().split()))
a -= 1
b -= 1
c -= 1
d -= 1
n = sum([math.ceil(i / 25) * 2 + 1 for i in [a, b, c, d]])
m = 50
result = []
result.append(['a' for _ in range(50)])
for i in range(math.ceil(b / 25)):
	temp = min(25, b - i * 25)
	result.append(['b' if j % 2 == 0 else 'a' for j in range(temp * 2)] + ['a' for _ in range(50 - temp * 2)])
	result.append(['a' for _ in range(50)])
result.append(['b' for _ in range(50)])
for i in range(math.ceil(a / 25)):
	temp = min(25, a - i * 25)
	result.append(['a' if j % 2 == 0 else 'b' for j in range(temp * 2)] + ['b' for _ in range(50 - temp * 2)])
	result.append(['b' for _ in range(50)])
result.append(['c' for _ in range(50)])
for i in range(math.ceil(d / 25)):
	temp = min(25, d - i * 25)
	result.append(['d' if j % 2 == 0 else 'c' for j in range(temp * 2)] + ['c' for _ in range(50 - temp * 2)])
	result.append(['c' for _ in range(50)])
result.append(['d' for _ in range(50)])
for i in range(math.ceil(c / 25)):
	temp = min(25, c - i * 25)
	result.append(['c' if j % 2 == 0 else 'd' for j in range(temp * 2)] + ['d' for _ in range(50 - temp * 2)])
	result.append(['d' for _ in range(50)])
print(n, m)
for row in result:
	print(''.join(row))


(a, b, c, d) = map(int, input().strip().split())

def fill(s, st, ch, cnt):
	(ri, ci) = (st, 0)
	while cnt > 0:
		s[ri][ci] = ch
		cnt -= 1
		ci += 2
		if ci >= 50:
			ri += 3
			ci = 0
dat = dict()
dat.update({'A': a, 'B': b, 'C': c, 'D': d})
dat = sorted(dat.items(), key=lambda kv: kv[1])
mf = dat[3]
lf = dat[0]
res = list()
for i in range(30):
	res.append(list(lf[0] * 50))
for i in range(20):
	res.append(list(mf[0] * 50))
fill(res, 0, dat[3][0], dat[3][1] - 1)
fill(res, 1, dat[2][0], dat[2][1])
fill(res, 2, dat[1][0], dat[1][1])
fill(res, 31, dat[0][0], dat[0][1] - 1)
print(50, 50)
for e_ in res:
	print(''.join(map(str, e_)))


(a, b, c, d) = map(int, input().split())
res = [['A'] * 50 for i in range(25)] + [['B'] * 50 for i in range(25)]
(a, b) = (a - 1, b - 1)
for i in range(0, 24, 2):
	for j in range(0, 50, 2):
		if b > 0:
			b -= 1
			res[i][j] = 'B'
		elif c > 0:
			c -= 1
			res[i][j] = 'C'
		elif d > 0:
			d -= 1
			res[i][j] = 'D'
		if a > 0:
			a -= 1
			res[i + 26][j] = 'A'
print(50, 50)
for i in res:
	print(''.join(i))


(a, b, c, d) = map(int, input().split(' '))
importance = [['A', a - 1], ['B', b - 1], ['C', c - 1], ['D', d - 1]]
field = []
width = 50
height = 50
print(height, width)
for y in range(25):
	field.append(['A'] * 25 + ['B'] * 25)
for y in range(25, 50):
	field.append(['C'] * 25 + ['D'] * 25)
for x in range(1, 25, 2):
	for y in range(1, 25, 2):
		if importance[1][1] > 0:
			field[y][x] = 'B'
			importance[1][1] -= 1
for x in range(26, 50, 2):
	for y in range(1, 25, 2):
		if importance[2][1] > 0:
			field[y][x] = 'C'
			importance[2][1] -= 1
for x in range(1, 25, 2):
	for y in range(26, 50, 2):
		if importance[3][1] > 0:
			field[y][x] = 'D'
			importance[3][1] -= 1
for x in range(26, 50, 2):
	for y in range(26, 50, 2):
		if importance[0][1] > 0:
			field[y][x] = 'A'
			importance[0][1] -= 1
for row in field:
	print(*row, sep='')


(a, b, c, d) = input().split(' ')
a = int(a)
b = int(b)
c = int(c)
d = int(d)
n = 50
m = 48
arr = [['A'] * n if i < n // 4 else ['B'] * n if i < 2 * n // 4 else ['C'] * n if i < 3 * n // 4 else ['D'] * n for i in range(m)]
for i in range(b - 1):
	arr[i // 25 * 2][i % 25 * 2] = 'B'
for i in range(c - 1):
	arr[12 + i // 25 * 2][i % 25 * 2] = 'C'
for i in range(d - 1):
	arr[24 + i // 25 * 2][i % 25 * 2] = 'D'
for i in range(a - 1):
	arr[36 + i // 25 * 2][i % 25 * 2] = 'A'
print(48, 50)
for i in range(48):
	print(''.join(arr[i]))


a = list(map(int, input().split()))
ab = [['A'] * 25 + ['B'] * 25 for i in range(25)]
cd = [['C'] * 25 + ['D'] * 25 for i in range(25)]
print(50, 50)
for i in range(4):
	a[i] -= 1
(si, sj) = (26, 26)
while a[0] > 0:
	cd[si - 25][sj] = 'A'
	a[0] -= 1
	sj += 2
	if sj == 50:
		sj = 26
		si += 2
(si, sj) = (26, 0)
while a[1] > 0:
	cd[si - 25][sj] = 'B'
	a[1] -= 1
	sj += 2
	if sj == 26:
		sj = 0
		si += 2
(si, sj) = (0, 0)
while a[2] > 0:
	ab[si][sj] = 'C'
	a[2] -= 1
	sj += 2
	if sj == 24:
		sj = 0
		si += 2
(si, sj) = (0, 26)
while a[3] > 0:
	ab[si][sj] = 'D'
	a[3] -= 1
	sj += 2
	if sj == 50:
		sj = 26
		si += 2
for i in ab:
	print(''.join(i))
for i in cd:
	print(''.join(i))


from functools import cmp_to_key
import sys

def getIntList():
	return list(map(int, input().split()))
f = getIntList()
fn = 'abcd'
matrix = [[-1 for x in range(50)] for x in range(50)]
for i in range(25):
	if i % 2 == 0:
		for j in range(50):
			matrix[i][j] = 0
	else:
		for j in range(50):
			if j % 2 == 0:
				matrix[i][j] = 0
for i in range(25):
	if i % 2 == 0:
		for j in range(50):
			matrix[i + 25][j] = 1
	else:
		for j in range(50):
			if j % 2 == 0:
				matrix[i + 25][j] = 1
f[0] -= 1
f[1] -= 1
for i in range(25):
	if i % 2 == 1:
		for j in range(0, 50):
			if j % 2 == 0:
				continue
			for x in range(1, 4):
				if f[x] > 0:
					f[x] -= 1
					matrix[i][j] = x
					break
			if matrix[i][j] < 0:
				matrix[i][j] = 0
for i in range(25):
	if i % 2 == 1:
		for j in range(0, 50):
			if j % 2 == 0:
				continue
			for x in range(0, 4):
				if x == 1:
					continue
				if f[x] > 0:
					f[x] -= 1
					matrix[i + 25][j] = x
					break
			if matrix[i + 25][j] < 0:
				matrix[i + 25][j] = 1
print(50, 50)
for i in range(50):
	for j in range(50):
		matrix[i][j] = chr(ord('A') + matrix[i][j])
	print(''.join(matrix[i]))


abcd = input().split(' ')
a = int(abcd[0])
b = int(abcd[1])
c = int(abcd[2])
d = int(abcd[3])
out = []
h = int(50 / 4)
for letter in 'D C B A'.split(' '):
	for i in range(h):
		out.append([letter for j in range(50)])
y = 0
for counts in [a - 1, b - 1, c - 1, d - 1]:
	counter = 0
	shift = 1
	for q in range(3):
		for x in range(49):
			if counter == counts:
				break
			out[y + shift + x % 2][x] = ['A', 'B', 'C', 'D'][int(y / h)]
			counter += 1
		shift += 3
		if counter == counts:
			break
	if counter < counts:
		for i in range(counts - counter):
			out[y + shift][2 * x] = ['A', 'B', 'C', 'D'][4 - int(y / h)]
	y += h
print(4 * h, 50)
for line in out:
	print(''.join(line))


from collections import deque

def read():
	return [int(v) for v in input().split()]

def main():
	colors = 'ABCD'
	counts = dict(zip(colors, read()))
	print(48, 50)
	for (i, c) in enumerate(colors):
		col_next = colors[(i + 1) % len(colors)]
		t = []
		for _ in range(12):
			t.append(list(c * 50))
		(indx, indy) = (0, 0)
		while counts[col_next] > 1:
			t[indx][indy] = col_next
			counts[col_next] -= 1
			indy += 2
			if indy == 50:
				indx += 2
				indy = 0
		for s in t:
			print(''.join(s))
main()


(a, b, c, d) = map(int, input().split())
m = [['a'] * 50 for i in range(40)]
for i in range(10, 20):
	m[i] = ['b'] * 50
for i in range(20, 30):
	m[i] = ['c'] * 50
for i in range(30, 40):
	m[i] = ['d'] * 50
for i in range(0, 10, 2):
	for j in range(50):
		if (i + j) % 2 == 0 and b > 1:
			b -= 1
			m[i][j] = 'b'
for i in range(10, 20, 2):
	for j in range(50):
		if (i + j) % 2 == 0 and c > 1:
			c -= 1
			m[i][j] = 'c'
for i in range(20, 30, 2):
	for j in range(50):
		if (i + j) % 2 == 0 and d > 1:
			d -= 1
			m[i][j] = 'd'
for i in range(30, 40, 2):
	for j in range(50):
		if (i + j) % 2 == 0 and a > 1:
			a -= 1
			m[i][j] = 'a'
print(40, 50)
for line in m:
	print(''.join(line))


a = [int(x) - 1 for x in input().split()]
n = m = 48
colors = 'ABCD'
side = n // 2
ans = [[0] * n for _ in range(n)]
for (i, color) in enumerate(colors):
	for dx in range(side):
		for dy in range(side):
			(x, y) = (dx + side * (i & 1), dy + side * (i // 2))
			ans[x][y] = color
			new_i = (i + 1) % 4
			if 0 < min(dx, dy) and max(dx, dy) < side - 1 and a[new_i] and dx & 1 and dy & 1:
				ans[x][y] = colors[new_i]
				a[new_i] -= 1
print(n, m)
print(*(''.join(row) for row in ans), sep='\n')


from string import ascii_uppercase as au
coef = tuple(map(int, input().split()))
paint = [['.' for i in range(48)] for j in range(33)]
for i in range(33):
	paint[i][11] = 'A'
	paint[i][23] = 'B'
	paint[i][24] = 'C'
	paint[i][36] = 'D'
need = (0, 11, 12, 23, 25, 36, 37, 48)
for_ = [[(x, y) for y in range(need[i * 2], need[i * 2 + 1], 2) for x in range(0, 33, 2)][:coef[3 - i] - 1] for i in range(4)[::-1]]
for (i, mas) in enumerate(for_):
	for el in mas:
		(X, Y) = el
		paint[X][Y] = au[i]
for k in range(4):
	for i in range(33):
		for j in range(need[2 * k], need[2 * k + 1]):
			if paint[i][j] == '.':
				paint[i][j] = au[k]
print(33, 48)
print('\n'.join((''.join(map(str, p)) for p in paint)))


import os, sys
from io import BytesIO, IOBase

def main():
	(a, b, c, d) = map(int, input().split())
	print(50, 50)
	arr = [[0] * 50 for _ in range(50)]
	for i in range(1, 24, 2):
		arr[i] = ['A'] * 50
	for i in range(24, 50, 2):
		arr[i] = ['B'] * 50
	for i in range(1, 50, 2):
		for j in range(24):
			arr[j][i] = 'A'
		for k in range(24, 50):
			arr[k][i] = 'B'
	(a, b) = (a - 1, b - 1)
	for i in range(24):
		for j in range(50):
			if not arr[i][j]:
				if b:
					arr[i][j] = 'B'
					b -= 1
				elif c:
					arr[i][j] = 'C'
					c -= 1
				elif d:
					arr[i][j] = 'D'
					d -= 1
				else:
					arr[i][j] = 'A'
	arr[24] = ['B'] * 50
	for i in range(25, 50):
		for j in range(50):
			if not arr[i][j]:
				if a:
					arr[i][j] = 'A'
					a -= 1
				else:
					arr[i][j] = 'B'
	for i in arr:
		print(*i, sep='')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


from copy import deepcopy
import itertools
from bisect import bisect_left
from bisect import bisect_right
import math

def read():
	return int(input())

def readmap():
	return map(int, input().split())

def readlist():
	return list(map(int, input().split()))
(A, B, C, D) = readmap()
print(50, 50)
arr = []
for _ in range(25):
	vec = ['A'] * 25 + ['B'] * 25
	arr.append(vec)
for _ in range(25):
	vec = ['C'] * 25 + ['D'] * 25
	arr.append(vec)
i = 1
j = 1
for _ in range(B - 1):
	arr[i][j] = 'B'
	j += 2
	if j == 25:
		j = 1
		i += 2
i = 1
j = 26
for _ in range(A - 1):
	arr[i][j] = 'A'
	j += 2
	if j == 50:
		j = 26
		i += 2
i = 26
j = 1
for _ in range(D - 1):
	arr[i][j] = 'D'
	j += 2
	if j == 25:
		j = 1
		i += 2
i = 26
j = 26
for _ in range(C - 1):
	arr[i][j] = 'C'
	j += 2
	if j == 50:
		j = 26
		i += 2
for i in range(50):
	print(''.join(arr[i]))


def popu(ans, s1, s2):
	k = []
	for j in range(50):
		k.append(s1)
	ans.append(k)
	(l1, l2) = ([s1, s2], [s1, s1])
	for i in range(4):
		ans.append(l1 * 25)
		ans.append(l2 * 25)
	k = []
	for j in range(50):
		k.append(s1)
	ans.append(k)

def dele(ans, sr, er, symtodel, symtomaj, d):
	for i in range(sr, er + 1):
		for j in range(50):
			if ans[i][j] == symtodel and d[symtodel] > 0:
				ans[i][j] = symtomaj
				d[symtodel] -= 1
(a, b, c, d) = list(map(int, input().split()))
d = {'A': 101 - a, 'B': 101 - b, 'C': 101 - c, 'D': 101 - d}
ans = []
popu(ans, 'A', 'B')
popu(ans, 'B', 'A')
popu(ans, 'C', 'D')
popu(ans, 'D', 'C')
dele(ans, 0, 9, 'B', 'A', d)
dele(ans, 10, 19, 'A', 'B', d)
dele(ans, 20, 29, 'D', 'C', d)
dele(ans, 30, 39, 'C', 'D', d)
print(40, 50)
for i in range(len(ans)):
	for j in ans[i]:
		print(j, end='')
	print('')


(a, b, c, l) = list(map(int, input().split()))
A = [['A' for i in range(50)] for j in range(8)]
B = [['B' for i in range(50)] for j in range(8)]
C = [['C' for i in range(50)] for j in range(8)]
D = [['D' for i in range(50)] for j in range(8)]
d = A + B + C + D

def pr(d):
	for i in d:
		print(''.join(i))
a -= 1
b -= 1
c -= 1
l -= 1
if c != 0:
	for i in range(0, 8, 2):
		for j in range(0, 50, 2):
			d[i][j] = 'C'
			c -= 1
			if c == 0:
				break
		if c == 0:
			break
if l != 0:
	for i in range(8, 16, 2):
		for j in range(0, 50, 2):
			d[i][j] = 'D'
			l -= 1
			if l == 0:
				break
		if l == 0:
			break
if a != 0:
	for i in range(16, 24, 2):
		for j in range(0, 50, 2):
			d[i][j] = 'A'
			a -= 1
			if a == 0:
				break
		if a == 0:
			break
if b != 0:
	for i in range(24, 32, 2):
		for j in range(0, 50, 2):
			d[i][j] = 'B'
			b -= 1
			if b == 0:
				break
		if b == 0:
			break
print(32, 50)
pr(d)


maxs = 50
cs = list(map(int, input().split(' ')))
field = [['A'] * maxs for _ in range(maxs)]
cs[0] -= 1
for yy in range(0, maxs):
	for xx in range(maxs - 8, maxs):
		field[yy][xx] = 'B'
cs[1] -= 1
for y in range(0, maxs, 2):
	for x in range(maxs - 8, maxs, 2):
		if cs[0] > 0:
			field[y][x + 1] = 'A'
			cs[0] -= 1
rest = 'B' * cs[1] + 'C' * cs[2] + 'D' * cs[3]
for y in range(0, maxs, 2):
	if len(rest) == 0:
		break
	for x in range(0, maxs - 8, 2):
		if len(rest) == 0:
			break
		c = rest[0]
		rest = rest[1:]
		field[y][x] = c
print(maxs, maxs)
for line in field:
	print(''.join(line))


import sys
input = sys.stdin.readline
l = input().split()
a = int(l[0])
b = int(l[1])
c = int(l[2])
d = int(l[3])
l = [[0 for i in range(50)] for i in range(50)]
print(50, 50)
for i in range(12):
	for j in range(50):
		l[i][j] = 'A'
for i in range(12, 25):
	for j in range(50):
		l[i][j] = 'B'
for i in range(25, 37):
	for j in range(50):
		l[i][j] = 'C'
for i in range(37, 50):
	for j in range(50):
		l[i][j] = 'D'
a -= 1
b -= 1
c -= 1
d -= 1
rem = d
for i in range(1, 11):
	for j in range(1, 49):
		if rem:
			if i % 3 == j % 3:
				l[i][j] = 'D'
				rem -= 1
rem = c
for i in range(13, 24):
	for j in range(1, 49):
		if rem:
			if i % 3 == j % 3:
				l[i][j] = 'C'
				rem -= 1
rem = b
for i in range(26, 36):
	for j in range(1, 49):
		if rem:
			if i % 3 == j % 3:
				l[i][j] = 'B'
				rem -= 1
rem = a
for i in range(38, 49):
	for j in range(1, 49):
		if rem:
			if i % 3 == j % 3:
				l[i][j] = 'A'
				rem -= 1
for i in range(50):
	for j in range(50):
		print(l[i][j], end='')
	print()


def create(bk, fr, num):
	a = [[bk for _ in range(50)] for _ in range(12)]
	flg = True
	for i in range(0, 12, 2):
		for j in range(0, 50, 2):
			if num == 0:
				flg = False
				break
			a[i][j] = fr
			num -= 1
		if flg == False:
			break
	return a
(a, b, c, d) = list(map(int, input().split()))
a -= 1
b -= 1
c -= 1
d -= 1
ans = []
ans.extend(create('A', 'B', b))
ans.extend(create('B', 'C', c))
ans.extend(create('C', 'D', d))
ans.extend(create('D', 'A', a))
print(48, 50)
for x in ans:
	for y in x:
		print(y, end='')
	print()


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, copy, functools
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
eps = 1.0 / 10 ** 10
mod = 998244353
dd = [(0, -1), (1, 0), (0, 1), (-1, 0)]
ddn = [(0, -1), (1, -1), (1, 0), (1, 1), (0, 1), (-1, -1), (-1, 0), (-1, 1)]

def LI():
	return [int(x) for x in sys.stdin.readline().split()]

def LI_():
	return [int(x) - 1 for x in sys.stdin.readline().split()]

def LF():
	return [float(x) for x in sys.stdin.readline().split()]

def LS():
	return sys.stdin.readline().split()

def I():
	return int(sys.stdin.readline())

def F():
	return float(sys.stdin.readline())

def S():
	return input()

def pf(s):
	return print(s, flush=True)

def main():
	(a, b, c, d) = LI()
	r = [[''] * 50 for _ in range(50)]
	for i in range(50):
		for j in range(50):
			if i < 25:
				if j < 25:
					r[i][j] = 'A'
				else:
					r[i][j] = 'B'
			elif j < 25:
				r[i][j] = 'C'
			else:
				r[i][j] = 'D'
	for i in range(a - 1):
		j = i // 12 * 2
		k = i % 12 * 2
		r[j][k + 26] = 'A'
	for i in range(b - 1):
		j = i // 12 * 2
		k = i % 12 * 2
		r[j][k] = 'B'
	for i in range(c - 1):
		j = i // 12 * 2
		k = i % 12 * 2
		r[j + 26][k + 26] = 'C'
	for i in range(d - 1):
		j = i // 12 * 2
		k = i % 12 * 2
		r[j + 26][k] = 'D'
	return '50 50\n' + '\n'.join(map(lambda x: ''.join(x), r))
print(main())


(a, b, c, d) = [int(x) - 1 for x in input().split()]
q = []
for i in range(48):
	if i // 12 == 0:
		q.append(['A'] * 48)
	elif i // 12 == 1:
		q.append(['B'] * 48)
	elif i // 12 == 2:
		q.append(['C'] * 48)
	else:
		q.append(['D'] * 48)
for i in range(48):
	for j in range(48):
		if i % 2 == 0 and j % 2 == 0:
			if i // 12 == 0 and c != 0:
				q[i][j] = 'C'
				c -= 1
			elif i // 12 == 1 and d != 0:
				q[i][j] = 'D'
				d -= 1
			elif i // 12 == 2 and a != 0:
				q[i][j] = 'A'
				a -= 1
			elif i // 12 == 3 and b != 0:
				q[i][j] = 'B'
				b -= 1
print(48, 48)
for i in range(48):
	for j in range(48):
		print(q[i][j], end='')
	print()


(a, b, c, d) = map(int, input().split())
m = []
for i in range(50):
	m.append([0] * 50)
for i in range(0, 25, 2):
	for j in range(0, 25, 2):
		if a == 1:
			break
		a -= 1
		m[i][j] = 'A'
	if a == 1:
		break
for i in range(25):
	for j in range(25):
		if m[i][j] == 0:
			m[i][j] = 'B'
for i in range(0, 25, 2):
	for j in range(26, 50, 2):
		if b == 1:
			break
		b -= 1
		m[i][j] = 'B'
	if b == 1:
		break
for i in range(25):
	for j in range(25, 50):
		if m[i][j] == 0:
			m[i][j] = 'C'
for i in range(26, 50, 2):
	for j in range(25, 50, 2):
		if c == 1:
			break
		c -= 1
		m[i][j] = 'C'
	if c == 1:
		break
for i in range(25, 50):
	for j in range(25, 50):
		if m[i][j] == 0:
			m[i][j] = 'D'
for i in range(25, 50, 2):
	for j in range(0, 24, 2):
		if d == 1:
			break
		d -= 1
		m[i][j] = 'D'
	if d == 1:
		break
for i in range(25, 50):
	for j in range(0, 25):
		if m[i][j] == 0:
			m[i][j] = 'A'
print(50, 50)
for i in range(50):
	for j in range(50):
		print(m[i][j], end='')
	print()


v = list(enumerate(map(int, input().split())))
v.sort(key=lambda x: x[1])
v = [[a, b] for (a, b) in v]
print(50, 50)
ss = [['.'] * 50 for _ in range(50)]
re_at = 0
while v[0][1] > 1 and re_at < 25:
	for (i, (a, r)) in enumerate(v[:3]):
		ch = ['A', 'B', 'C', 'D'][a]
		if i == 0:
			ss[0][2 * re_at + 1] = ch
		elif i == 1:
			ss[0][2 * re_at] = ch
		elif i == 2:
			ss[1][2 * re_at + 1] = ch
	(v[0][1], v[1][1], v[2][1]) = (v[0][1] - 1, v[1][1] - 1, v[2][1] - 1)
	re_at += 1
if re_at > 0 and re_at < 25:
	ss[0][2 * re_at] = ['A', 'B', 'C', 'D'][v[3][0]]
	v[3][1] -= 1
re_at = 0
while v[0][1] > 1 and re_at < 25:
	for (i, (a, r)) in enumerate(v):
		if i == 1:
			continue
		ch = ['A', 'B', 'C', 'D'][a]
		if i == 0:
			ss[49][2 * re_at + 1] = ch
		elif i == 2:
			ss[49][2 * re_at] = ch
		elif i == 3:
			ss[48][2 * re_at + 1] = ch
	(v[0][1], v[3][1], v[2][1]) = (v[0][1] - 1, v[3][1] - 1, v[2][1] - 1)
	re_at += 1
if re_at > 0 and re_at < 25:
	ss[49][2 * re_at] = ['A', 'B', 'C', 'D'][v[3][0]]
	v[3][1] -= 1
re_at = 0
while v[0][1] > 1 and re_at < 25:
	for (i, (a, r)) in enumerate(v[:2]):
		ch = ['A', 'B', 'C', 'D'][a]
		if i == 0:
			ss[48][2 * re_at] = ch
		elif i == 1:
			ss[47][2 * re_at] = ch
	(v[0][1], v[1][1]) = (v[0][1] - 1, v[1][1] - 1)
	re_at += 1
re_at = 0
while v[0][1] > 1 and re_at < 25:
	for (i, (a, r)) in enumerate(v[:3]):
		if i == 1:
			continue
		ch = ['A', 'B', 'C', 'D'][a]
		if i == 0:
			ss[47][2 * re_at + 1] = ch
		elif i == 2:
			ss[46][2 * re_at + 1] = ch
	(v[0][1], v[2][1]) = (v[0][1] - 1, v[2][1] - 1)
	re_at += 1
for (a, r) in v[1:]:
	re_at = 0
	row = [4, 5, 7, 8, 10]
	ch = ['A', 'B', 'C', 'D'][a]
	row_at = 0
	while row_at < 5 and re_at < r:
		sc1 = 10 * a + row[row_at]
		i = 0
		sc2 = 3 + (1 if row_at in [1, 3] else 0)
		while i < 22 and re_at < r:
			ss[sc1][sc2] = ch
			sc2 += 2
			i += 1
			re_at += 1
		row_at += 1
ch = ['A', 'B', 'C', 'D'][v[0][0]]
for ss1 in ss:
	ss2 = ''.join(ss1)
	ss2 = ss2.replace('.', ch)
	print(ss2)