Galois is one of the strongest chess players of Byteforces. He has even invented a new variant of chess, which he named «PawnChess».

This new game is played on a board consisting of 8 rows and 8 columns. At the beginning of every game some black and white pawns are placed on the board. The number of black pawns placed is not necessarily equal to the number of white pawns placed.  $8$ 

Lets enumerate rows and columns with integers from 1 to 8. Rows are numbered from top to bottom, while columns are numbered from left to right. Now we denote as (r, c) the cell located at the row r and at the column c.

There are always two players A and B playing the game. Player A plays with white pawns, while player B plays with black ones. The goal of player A is to put any of his pawns to the row 1, while player B tries to put any of his pawns to the row 8. As soon as any of the players completes his goal the game finishes immediately and the succeeded player is declared a winner.

Player A moves first and then they alternate turns. On his move player A must choose exactly one white pawn and move it one step upward and player B (at his turn) must choose exactly one black pawn and move it one step down. Any move is possible only if the targeted cell is empty. It's guaranteed that for any scenario of the game there will always be at least one move available for any of the players.

Moving upward means that the pawn located in (r, c) will go to the cell (r - 1, c), while moving down means the pawn located in (r, c) will go to the cell (r + 1, c). Again, the corresponding cell must be empty, i.e. not occupied by any other pawn of any color.

Given the initial disposition of the board, determine who wins the game if both players play optimally. Note that there will always be a winner due to the restriction that for any game scenario both players will have some moves available.


-----Input-----

The input consists of the board description given in eight lines, each line contains eight characters. Character 'B' is used to denote a black pawn, and character 'W' represents a white pawn. Empty cell is marked with '.'. 

It's guaranteed that there will not be white pawns on the first row neither black pawns on the last row.


-----Output-----

Print 'A' if player A wins the game on the given board, and 'B' if player B will claim the victory. Again, it's guaranteed that there will always be a winner on the given board.


-----Examples-----
Input
........
........
.B....B.
....W...
........
..W.....
........
........

Output
A

Input
..B.....
..W.....
......B.
........
.....W..
......B.
........
........

Output
B



-----Note-----

In the first sample player A is able to complete his goal in 3 steps by always moving a pawn initially located at (4, 5). Player B needs at least 5 steps for any of his pawns to reach the row 8. Hence, player A will be the winner.

Difficulty: EASY

Solutions:
board = []
for i in range(8):
	board.append(input())
minwdist = 999
minbdist = 999
for i in range(8):
	seenb = False
	currminwdist = None
	currminbdist = None
	for j in range(8):
		v = board[j][i]
		if v == 'B':
			seenb = True
		if seenb and v == 'W':
			currminbdist = None
		elif v == 'W':
			if not currminwdist:
				currminwdist = j
		if v == 'B':
			currminbdist = 8 - j - 1
	if currminwdist:
		minwdist = min(minwdist, currminwdist)
	if currminbdist:
		minbdist = min(minbdist, currminbdist)
if minwdist <= minbdist:
	print('A')
else:
	print('B')


import time
a = [[0 for j in range(8)] for i in range(8)]
for i in range(8):
	b = input()
	for j in range(8):
		a[j][i] = b[j]
start = time.time()
mW = 10
mB = 10
for i in range(8):
	flag = True
	for j in range(8):
		if a[i][j] == 'B':
			flag = False
			break
		if a[i][j] == 'W':
			break
	if flag == False:
		continue
	if mW > j:
		mW = j
for i in range(8):
	flag = True
	for j in range(8):
		if a[i][7 - j] == 'W':
			flag = False
			break
		if a[i][7 - j] == 'B':
			break
	if flag == False:
		continue
	if mB > j:
		mB = j
if mW <= mB:
	print('A')
else:
	print('B')
finish = time.time()


l = [[0] * 8 for i in range(8)]
steps_w = [8] * 8
steps_b = [8] * 8
for i in range(8):
	l[i] = list(input())
for i in range(8):
	w = []
	b = []
	for j in range(8):
		if l[j][i] == 'W':
			w.append(j)
		if l[j][i] == 'B':
			b.append(j)
	if len(w) == 0 and len(b) == 0:
		continue
	if len(w) == 0:
		steps_b[i] = 7 - max(b)
		continue
	if len(b) == 0:
		steps_w[i] = min(w)
		continue
	if max(w) < max(b):
		steps_b[i] = 7 - max(b)
	if min(w) < min(b):
		steps_w[i] = min(w)
print('A' if min(steps_w) <= min(steps_b) else 'B')


import os
import sys
from io import BytesIO, IOBase
mod = 10 ** 9 + 7
from math import inf

def main():
	arr = []
	for _ in range(8):
		arr.append(list(input()))
	ansa = inf
	for i in range(8):
		for j in range(8):
			if arr[j][i] == '.':
				pass
			elif arr[j][i] == 'B':
				break
			else:
				ansa = min(ansa, j)
				break
	ansb = inf
	for i in range(7, -1, -1):
		for j in range(7, -1, -1):
			if arr[j][i] == '.':
				pass
			elif arr[j][i] == 'W':
				break
			else:
				ansb = min(ansb, 7 - j)
				break
	if ansa > ansb:
		print('B')
	else:
		print('A')

def nouse0():
	a = 420
	b = 420
	print(f'i am nitish{(a + b) // 2}')

def nouse1():
	a = 420
	b = 420
	print(f'i am nitish{(a + b) // 2}')

def nouse2():
	a = 420
	b = 420
	print(f'i am nitish{(a + b) // 2}')
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')

def nouse3():
	a = 420
	b = 420
	print(f'i am nitish{(a + b) // 2}')

def nouse4():
	a = 420
	b = 420
	print(f'i am nitish{(a + b) // 2}')

def nouse5():
	a = 420
	b = 420
	print(f'i am nitish{(a + b) // 2}')
main()


import sys
m = []
for i in range(8):
	m.append(input())
a = -1
b = -1
for i in range(8):
	for col in range(8):
		if m[i][col] == 'W':
			a = i
			for j in range(i):
				if m[j][col] != '.':
					a = -1
					break
			if a != -1:
				break
	if a != -1:
		break
i = 7
while i >= 0:
	col = 0
	while col < 8:
		if m[i][col] == 'B':
			b = i
			j = i + 1
			while j < 8:
				if m[j][col] != '.':
					b = -1
					break
				j += 1
			if b != -1:
				break
		col += 1
	if b != -1:
		break
	i -= 1
if a <= 7 - b:
	print('A')
else:
	print('B')


(w, b) = ([], [])
for i in range(8):
	s = list(input())
	for j in range(8):
		if s[j] == 'W':
			w.append([i, j])
		if s[j] == 'B':
			b.append([i, j])
resa = 1000000
for i in range(len(w)):
	tmp = 100000000000
	for j in range(len(b)):
		if w[i][1] == b[j][1] and w[i][0] > b[j][0]:
			break
		else:
			tmp = w[i][0]
			if j == len(b) - 1:
				resa = min(tmp, resa)
resb = 1000000000000
for i in range(len(b)):
	tmp = 100000000
	for j in range(len(w)):
		if w[j][1] == b[i][1] and w[j][0] > b[i][0]:
			break
		else:
			tmp = 7 - b[i][0]
			if j == len(w) - 1:
				resb = min(tmp, resb)
if resa == resb:
	print('A')
	quit()
if resa < resb:
	print('A')
else:
	print('B')


board = []
for i in range(8):
	board.append([i for i in input()])
blacks = []
whites = []
for (i, li) in enumerate(board):
	for (j, lj) in enumerate(board[i]):
		if board[i][j] == 'B':
			blacks.append([i, j])
		elif board[i][j] == 'W':
			whites.append([i, j])
min_white = 9
for i in whites:
	if i[0] < min_white:
		can = True
		for j in blacks:
			if i[1] == j[1] and i[0] > j[0]:
				can = False
		if can:
			min_white = i[0]
max_black = 0
for i in blacks:
	if i[0] > max_black:
		can = True
		for j in whites:
			if i[1] == j[1] and i[0] < j[0]:
				can = False
		if can:
			max_black = i[0]
if min_white <= 7 - max_black:
	print('A')
else:
	print('B')


z = []
for i in range(8):
	z.append(input())
(a, b) = (9, 9)
for i in range(8):
	for j in range(8):
		if z[i][j] == 'W':
			sedi = True
			for r in range(0, i):
				if z[r][j] == 'B':
					sedi = False
					break
			if sedi:
				a = min(a, i)
		elif z[i][j] == 'B':
			sedi = True
			for r in range(i + 1, 8):
				if z[r][j] == 'W':
					sedi = False
					break
			if sedi:
				b = min(b, 7 - i)
print('A' if a <= b else 'B')


from sys import stdin
live = True
if not live:
	stdin = open('data.in', 'r')
closeA = closeB = 7
lines = [''] * 8
for it in range(1, 9):
	lines[it - 1] = list(stdin.readline().strip())
for it in range(0, 8):
	for jt in range(0, 8):
		if lines[it][jt] == 'W' and it < closeA:
			save = True
			for iit in range(0, it):
				if lines[iit][jt] != '.':
					save = False
			if save:
				closeA = it
		if lines[it][jt] == 'B' and 7 - it < closeB:
			save = True
			for iit in range(it + 1, 8):
				if lines[iit][jt] != '.':
					save = False
			if save:
				closeB = 7 - it
if closeA <= closeB:
	print('A')
else:
	print('B')
if not live:
	stdin.close()


import sys
INF = 1061109567
table = [line for line in sys.stdin]
(a, b) = (INF, INF)
for i in range(8):
	for j in range(8):
		if table[j][i] == 'W':
			a = min(a, j)
			break
		if table[j][i] == 'B':
			break
for i in range(8):
	for j in range(7, -1, -1):
		if table[j][i] == 'B':
			b = min(b, 8 - j)
			break
		if table[j][i] == 'W':
			break
print('A' if a < b else 'B')


table = [input() for _ in range(8)]
table = list((''.join(x) for x in zip(*table)))
(wMin, bMin) = (100, 100)
for row in table:
	try:
		bDist = tuple(reversed(row)).index('B')
	except ValueError:
		bDist = 1000
	try:
		wDist = row.index('W')
	except ValueError:
		wDist = 1000
	nodots = row.translate({ord('.'): None})
	if nodots:
		if nodots[0] == 'B':
			wDist = 1000
		if nodots[-1] == 'W':
			bDist = 1000
	if bDist == 1000 and wDist == 1000:
		continue
	bMin = min(bMin, bDist)
	wMin = min(wMin, wDist)
print('A' if wMin <= bMin else 'B')


A = []
for i in range(8):
	A += [input()]
(mA, mB) = (None, None)
for r in range(8):
	for c in range(8):
		if A[r][c] == 'W':
			v = True
			for x in range(r):
				if A[x][c] == 'B':
					v = False
					break
			if v:
				if mA == None:
					mA = r
				else:
					mA = min(mA, r)
		if A[r][c] == 'B':
			v = True
			for x in range(r + 1, 8):
				if A[x][c] == 'W':
					v = False
					break
			if v:
				if mB == None:
					mB = 7 - r
				else:
					mB = min(mB, 7 - r)
if not mA or mA > mB:
	print('B')
else:
	print('A')


def read_row(s):
	row = []
	for item in s:
		if item == 'W':
			row.append(1)
		elif item == 'B':
			row.append(0)
		else:
			row.append(None)
	return row
table = []
for i in range(8):
	table.append(read_row(input()))
columns = []
for i in range(8):
	column = []
	for j in range(8):
		column.append(table[j][i])
	columns.append(column)
min_moves_for_a = 8
min_moves_for_b = 8
for col in columns:
	if (0 in col) & (not 1 in col):
		moves_for_b = col[::-1].index(0)
		if moves_for_b < min_moves_for_b:
			min_moves_for_b = moves_for_b
	if (1 in col) & (not 0 in col):
		moves_for_a = col.index(1)
		if moves_for_a < min_moves_for_a:
			min_moves_for_a = moves_for_a
	if (1 in col) & (0 in col):
		if col.index(1) < col.index(0):
			moves_for_a = col.index(1)
			if moves_for_a < min_moves_for_a:
				min_moves_for_a = moves_for_a
		if col[::-1].index(0) <= col[::-1].index(1):
			moves_for_b = col[::-1].index(0)
			if moves_for_b < min_moves_for_b:
				min_moves_for_b = moves_for_b
if min_moves_for_a <= min_moves_for_b:
	print('A')
else:
	print('B')


board = [input() for i in range(8)]
A = B = 1000
for i in range(8):
	for j in range(8):
		if board[j][i] == 'B':
			break
		if board[j][i] == 'W':
			A = min(A, j)
	for j in range(8):
		if board[7 - j][i] == 'W':
			break
		if board[7 - j][i] == 'B':
			B = min(B, j)
if A <= B:
	print('A')
else:
	print('B')


a = [8 for _ in range(8)]
b = [8 for _ in range(8)]
for r in range(8):
	row = input()
	for (i, c) in enumerate(row):
		if c == 'W':
			if a[i] == b[i] == 8:
				a[i] = r
			b[i] = 9
		elif c == 'B':
			b[i] = 7 - r
a = min(a)
b = min(b)
print('A' if a <= b else 'B')


(s, a, b) = ([], 80, 0)
for i in range(8):
	s.append(input())
for j in range(8):
	for i in range(8):
		if s[i][j] == 'W':
			a = min(a, i)
			break
		elif s[i][j] == 'B':
			break
	for i in range(7, -1, -1):
		if s[i][j] == 'B':
			b = max(b, i)
			break
		elif s[i][j] == 'W':
			break
if a <= 7 - b:
	print('A')
else:
	print('B')


grid = []
for k in range(8):
	grid.append(input())
bbc = []
bwc = []
white = 8
for k in range(8):
	for j in range(8):
		if grid[k][j] == 'B':
			bbc.append(j)
		if grid[k][j] == 'W' and (not j in bbc) and (white == 8):
			white = k
black = 8
for k in range(7, -1, -1):
	for j in range(8):
		if grid[k][j] == 'W':
			bwc.append(j)
		if grid[k][j] == 'B' and (not j in bwc) and (black == 8):
			black = 7 - k
if white <= black:
	print('A')
else:
	print('B')


def board(lst):
	(A, B) = (1000, 1000)
	for i in range(8):
		for j in range(8):
			if lst[j][i] == 'B':
				break
			if lst[j][i] == 'W':
				A = min(A, j)
		for j in range(8):
			if lst[7 - j][i] == 'W':
				break
			if lst[7 - j][i] == 'B':
				B = min(B, j)
	if A <= B:
		return 'A'
	return 'B'
a = [input() for x in range(8)]
print(board(a))


import sys
b = []
for i in range(8):
	b.append(list(input()))
ans1 = 8
ans2 = 8
for j in range(8):
	for i in range(8):
		if b[i][j] == 'B':
			break
		if b[i][j] == 'W':
			ans1 = min(i, ans1)
for j in range(8):
	for i in range(7, -1, -1):
		if b[i][j] == 'W':
			break
		if b[i][j] == 'B':
			ans2 = min(8 - i - 1, ans2)
if ans1 <= ans2:
	print('A')
else:
	print('B')


class CodeforcesTask592ASolution:

	def __init__(self):
		self.result = ''
		self.board = []

	def read_input(self):
		for x in range(8):
			self.board.append(input())

	def process_task(self):
		amin = 8
		bmin = 8
		n_board = []
		for x in range(8):
			line = ''
			for y in range(8):
				line += self.board[y][x]
			n_board.append(line)
		for b in n_board:
			if 'B' in b:
				if 'W' not in b.split('B')[-1]:
					bmin = min(bmin, len(b.split('B')[-1]))
			if 'W' in b:
				if 'B' not in b.split('W')[0]:
					amin = min(amin, len(b.split('W')[0]))
		self.result = 'A' if amin <= bmin else 'B'

	def get_result(self):
		return self.result
Solution = CodeforcesTask592ASolution()
Solution.read_input()
Solution.process_task()
print(Solution.get_result())


a = [list(input()) for j in range(8)]
cntW = 10
cntB = 10
for i in range(8):
	for j in range(8):
		if a[i][j] == 'W':
			b1 = True
			for k in range(i):
				if a[k][j] != '.':
					b1 = False
			if b1:
				cntW = min(cntW, i)
		elif a[i][j] == 'B':
			b1 = True
			for k in range(i + 1, 8):
				if a[k][j] != '.':
					b1 = False
			if b1:
				cntB = min(cntB, 7 - i)
if cntW <= cntB:
	print('A')
else:
	print('B')


def main():
	board = []
	a = 100
	b = 100
	for t in range(8):
		row = list(input())
		board.append(row)
	for i in range(8):
		for j in range(8):
			if board[i][j] == 'W':
				flag = 1
				for k in range(i):
					if board[k][j] == 'B':
						flag = 0
				if flag == 1:
					a = min(a, k + 1)
			elif board[i][j] == 'B':
				flag = 1
				for k in range(i, 8):
					if board[k][j] == 'W':
						flag = 0
				if flag == 1:
					b = min(b, 7 - i)
	if a <= b:
		print('A')
	else:
		print('B')
main()


a = [[] for i in range(8)]
colw = []
colb = []
for i in range(8):
	a[i] = input()
	for v in range(8):
		if a[i][v] == 'W':
			colw.append([i, v])
		elif a[i][v] == 'B':
			colb.append([i, v])
w = 0
minw = 8
for i in range(len(colw)):
	for v in range(colw[i][0]):
		if a[v][colw[i][1]] != 'B':
			w += 1
		else:
			w = 0
			break
	if w > 0 and w < minw:
		minw = w
	w = 0
b = 0
minb = 8
for i in range(len(colb)):
	for v in range(7, colb[i][0], -1):
		if a[v][colb[i][1]] != 'W':
			b += 1
		else:
			b = 0
			break
	if b > 0 and b < minb:
		minb = b
	b = 0
if minb < minw:
	print('B')
else:
	print('A')


lines = [[] for i in range(8)]
for i in range(8):
	r = input()
	for c in range(8):
		lines[c].append(r[c])
min_bl = 10
min_wi = 10
for line in lines:
	if 'B' in line:
		rig_b = line[::-1].index('B')
		if 'W' in line:
			rig_w = line[::-1].index('W')
			if rig_b < rig_w:
				min_bl = min(min_bl, rig_b + 1)
		else:
			min_bl = min(min_bl, rig_b + 1)
	if 'W' in line:
		lef_w = line.index('W')
		if 'B' in line:
			lef_b = line.index('B')
			if lef_w < lef_b:
				min_wi = min(min_wi, lef_w)
		else:
			min_wi = min(min_wi, lef_w)
print('A' if min_wi < min_bl else 'B')


B = [list(input()) for i in range(0, 8)]
A_min = 9
B_min = 9
for i in range(8):
	A_tmp = False
	B_tmp = False
	for j in range(8):
		if B[j][i] == 'W':
			if B_tmp is False:
				A_tmp = min(A_tmp, j) if A_tmp is not False else j
			else:
				B_tmp = 0
		elif B[j][i] == 'B':
			B_tmp = j
	A_min = min(A_min, A_tmp) if A_tmp is not False else A_min
	B_min = min(B_min, 7 - B_tmp) if B_tmp is not False else B_min
if A_min <= B_min:
	print('A')
else:
	print('B')


board = []

def check(i, j, fig):
	global board
	if fig == 'W':
		while i < 8:
			if board[i][j] == 'W':
				return True
			i += 1
	else:
		while i >= 0:
			if board[i][j] == 'B':
				return True
			i -= 1
	return False
for i in range(8):
	board.append(input())
bm = 10
wm = 10
for i in range(8):
	for j in range(8):
		if board[i][j] == 'B':
			if not check(i + 1, j, 'W'):
				bm = min(bm, 8 - i)
		elif board[i][j] == 'W':
			if not check(i - 1, j, 'B'):
				wm = min(wm, i + 1)
if wm <= bm:
	print('A')
else:
	print('B')


a = []
amin = bmin = 999
flag = 1
for i in range(8):
	a.append(input())
for i in range(8):
	for j in range(8):
		if a[i][j] == 'W':
			flag = 1
			for k in range(0, i):
				if a[k][j] == 'B':
					flag = 0
					break
			if flag:
				amin = min(amin, i)
		elif a[i][j] == 'B':
			flag = 1
			for k in range(i, 8):
				if a[k][j] == 'W':
					flag = 0
					break
			if flag:
				bmin = min(bmin, 7 - i)
if amin <= bmin:
	print('A')
else:
	print('B')


import itertools as it
import functools
import operator
import collections
import math
import sys

def solve(board):
	board_trans = [''.join(r) for r in zip(*board)]
	print_stderr(board_trans)
	white_steps = 10
	black_steps = 10
	for row in board_trans:
		if 'W' in row and 'B' in row:
			white_left = row.find('W')
			black_left = row.find('B')
			white_right = row.rfind('W')
			black_right = row.rfind('B')
			if white_left < black_left:
				white_steps = min(white_steps, white_left)
			if white_right < black_right:
				black_steps = min(black_steps, 7 - black_right)
		elif 'W' in row:
			white_idx = row.find('W')
			white_steps = min(white_steps, white_idx)
		elif 'B' in row:
			black_idx = row.rfind('B')
			black_steps = min(black_steps, 7 - black_idx)
		print_stderr('(W, B)', white_steps, black_steps)
	if white_steps <= black_steps:
		return 'A'
	else:
		return 'B'

def print_stderr(*args, **kwargs):
	print(*args, file=sys.stderr, **kwargs)

def main():
	board = [input().strip() for _ in range(8)]
	assert len(board[0]) == 8
	result = solve(board)
	print(result)
main()


a = [[''] * 8 for i in range(8)]
for i in range(8):
	a[i] = [i for i in input()]
mn1 = 9
mn2 = 9
for i in range(8):
	flag = True
	for j in range(8):
		if flag and a[j][i] == 'W':
			flag = False
			mn1 = min(mn1, j)
		if a[j][i] == 'B':
			flag = False
for i in range(8):
	flag = True
	for j in range(7, -1, -1):
		if flag and a[j][i] == 'B':
			flag = False
			mn2 = min(mn2, 7 - j)
		if a[j][i] == 'W':
			flag = False
if mn1 <= mn2:
	print('A')
else:
	print('B')


a = ['', '', '', '', '', '', '', '']
for i in range(8):
	s = input()
	r = 0
	for j in s:
		a[r] += j
		r += 1
(Akmin, Bkmin) = (100, 100)
for i in a:
	(Ak, Bk) = (0, 200)
	for j in i:
		if j == 'B':
			Bk = 0
			Ak = 200
		if j == 'W':
			Bk = 200
			if Ak < Akmin:
				Akmin = Ak
		if j == '.':
			Ak += 1
			Bk += 1
	if Bk < Bkmin:
		Bkmin = Bk
if Akmin <= Bkmin:
	print('A')
else:
	print('B')


board = []

class color:
	(white, black) = (8, 8)

def check(r, c, up):
	while r >= 0 and r < 8:
		if board[r][c] == '.':
			r += up
		else:
			return False
	return True

def find(char):
	for j in range(8):
		for k in range(8):
			if board[j][k] == char:
				if char == 'W':
					if check(j - 1, k, -1) == True:
						color.white = min(color.white, j)
				elif check(j + 1, k, 1) == True:
					color.black = min(color.black, 8 - j - 1)
for j in range(8):
	board.append(str(input()))
find('W')
find('B')
if color.white <= color.black:
	print('A')
else:
	print('B')


__author__ = 'artyom'

def main(n):
	bd = [None] * n
	for i in range(n):
		bd[i] = read(0)
	w = n
	z = [0] * n
	for i in range(n):
		for j in range(n):
			if bd[i][j] == 'W':
				if z[j] == 0:
					w = i
					break
			elif bd[i][j] == 'B':
				z[j] = 1
		else:
			continue
		break
	b = n
	z = [0] * n
	for i in range(n - 1, -1, -1):
		for j in range(n):
			if bd[i][j] == 'B':
				if z[j] == 0:
					b = n - 1 - i
					break
			elif bd[i][j] == 'W':
				z[j] = 1
		else:
			continue
		break
	return w <= b

def read(mode=1, size=None):
	if mode == 0:
		return input().strip()
	if mode == 1:
		return int(input().strip())
	if mode == 2:
		return input().strip().split()
	if mode == 3:
		return list(map(int, input().strip().split()))
	a = []
	for _ in range(size):
		a.append(read(3))
	return a

def write(s='\n'):
	if s is None:
		s = ''
	if isinstance(s, tuple) or isinstance(s, list):
		s = ' '.join(map(str, s))
	s = str(s)
	print(s)
write(['B', 'A'][main(8)])


thing = []
for i in range(8):
	thing += [input()]
lowestB = 0
highestW = 7
for i in range(8):
	column = []
	for j in range(8):
		row = thing[j]
		column += [row[i]]
	if 'B' in column:
		for m in range(7, -1, -1):
			if column[m] == 'W':
				break
			if column[m] == 'B':
				if m >= lowestB:
					lowestB = m
	if 'W' in column:
		for m in range(7):
			if column[m] == 'B':
				break
			if column[m] == 'W':
				if m <= highestW:
					highestW = m
if highestW <= 7 - lowestB:
	print('A')
else:
	print('B')


import math, sys, re, itertools, pprint, collections, copy
(ri, rai) = (lambda : int(input()), lambda : list(map(int, input().split())))
a = sys.stdin.readlines()
ca = cb = 10
for j in range(8):
	for i in range(8):
		if a[i][j] == 'W':
			ca = min(ca, i)
		if a[i][j] == 'B':
			break
for j in range(8):
	for i in reversed(range(8)):
		if a[i][j] == 'B':
			cb = min(cb, 7 - i)
		if a[i][j] == 'W':
			break
print('A' if ca <= cb else 'B')


Matrix = [[] for x in range(8)]
for i in range(8):
	Matrix[i] = [x for x in input()]
bestWhite = 8
bestBlack = -1
for i in range(8):
	for j in range(8):
		if Matrix[j][i] == 'B':
			break
		elif Matrix[j][i] == 'W':
			if j < bestWhite:
				bestWhite = j
			break
	for k in range(7, -1, -1):
		if Matrix[k][i] == 'W':
			break
		elif Matrix[k][i] == 'B':
			if k > bestBlack:
				bestBlack = k
			break
if 7 - bestBlack >= bestWhite:
	print('A')
else:
	print('B')


l = []
c = [[], [], [], [], [], [], [], [], [], []]
for i in range(8):
	l.append(input())
for i in range(8):
	for j in range(8):
		c[i].append(l[j][i])
sw = []
sb = []
for i in range(8):
	apw = 8
	apb = 8
	down = 0
	up = 0
	for j in range(8):
		if c[i][j] == 'W' and apw == 8 and (down == 0):
			apw = j
			down = 1
		if c[i][j] == 'B' and down == 0:
			down = 1
		if c[i][7 - j] == 'B' and apb == 8 and (up == 0):
			apb = j
			up = 1
		if c[i][7 - j] == 'W' and up == 0:
			up = 1
	sw.append(apw)
	sb.append(apb)
mw = min(sw)
mb = min(sb)
if mb < mw:
	print('B')
else:
	print('A')


rows = [input() for i in range(8)]
cols = [0] * 8
for i in range(8):
	cols[i] = ''.join([row[i] for row in rows])
(white, black) = (100, 100)
for col in cols:
	(firstB, firstW) = (col.find('B'), col.find('W'))
	if firstW != -1 and (firstB == -1 or firstB > firstW):
		white = min(white, firstW)
	(lastB, lastW) = (col.rfind('B'), col.rfind('W'))
	if lastB != -1 and (lastW == -1 or lastW < lastB):
		black = min(black, 7 - lastB)
if white <= black:
	print('A')
else:
	print('B')


from collections import deque as de
import math
import sys
import re
from collections import Counter as cnt
from functools import reduce
from typing import MutableMapping
from itertools import groupby as gb
from fractions import Fraction as fr
from bisect import bisect_left as bl, bisect_right as br

def factors(n):
	return set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0)))

class My_stack:

	def __init__(self):
		self.data = []

	def my_push(self, x):
		return self.data.append(x)

	def my_pop(self):
		return self.data.pop()

	def my_peak(self):
		return self.data[-1]

	def my_contains(self, x):
		return self.data.count(x)

	def my_show_all(self):
		return self.data

	def isEmpty(self):
		return len(self.data) == 0
arrStack = My_stack()

def decimalToBinary(n):
	return bin(n).replace('0b', '')

def binarytodecimal(n):
	return int(n, 2)

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True

def get_prime_factors(number):
	prime_factors = []
	while number % 2 == 0:
		prime_factors.append(2)
		number = number / 2
	for i in range(3, int(math.sqrt(number)) + 1, 2):
		while number % i == 0:
			prime_factors.append(int(i))
			number = number / i
	if number > 2:
		prime_factors.append(int(number))
	return prime_factors

def get_frequency(list):
	dic = {}
	for ele in list:
		if ele in dic:
			dic[ele] += 1
		else:
			dic[ele] = 1
	return dic

def Log2(x):
	return math.log10(x) / math.log10(2)

def getProduct(n):
	product = 1
	while n != 0:
		product = product * (n % 10)
		n = n // 10
	return product

def dupconscount(nums):
	element = []
	freque = []
	if not nums:
		return element
	running_count = 1
	for i in range(len(nums) - 1):
		if nums[i] == nums[i + 1]:
			running_count += 1
		else:
			freque.append(running_count)
			element.append(nums[i])
			running_count = 1
	freque.append(running_count)
	element.append(nums[i + 1])
	return (element, freque)

def isPowerOfTwo(n):
	return math.ceil(Log2(n)) == math.floor(Log2(n))

def checkisap(list):
	d = list[1] - list[0]
	for i in range(2, len(list)):
		temp = list[i] - list[i - 1]
		if temp != d:
			return False
	return True

def ceildiv(x, y):
	return (x + y - 1) // y

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

def ii():
	return int(input())

def li():
	return sorted(list(map(int, input().split())), reverse=True)

def si():
	return list(map(str, input()))

def indic():
	dic = {}
	for (index, value) in enumerate(input().split()):
		dic[int(value)] = int(index) + 1
	return dic

def column(matrix, i):
	return [row[i] for row in matrix]
l = [si() for i in range(8)]
wc = []
bc = []
for i in range(8):
	for j in range(8):
		if l[i][j] == 'B':
			ch = 1
			temp = column(l, j)
			for k in range(i + 1, 8):
				if temp[k] != '.':
					ch = 0
					break
			if ch:
				bc.append(8 - (i + 1))
		elif l[i][j] == 'W':
			ch = 1
			temp = column(l, j)
			for k in range(i - 1, -1, -1):
				if temp[k] != '.':
					ch = 0
					break
			if ch:
				wc.append(i)
wc.sort()
bc.sort()
if bc[0] <= wc[0] - 1:
	print('B')
else:
	print('A')


import sys
a = [input() for _ in range(8)]
a = [''.join([a[i][j] for i in range(8)]) for j in range(8)]
for _ in range(8):
	for i in range(8):
		if a[i].startswith('.' * _ + 'W'):
			print('A')
			sys.exit(0)
	for i in range(8):
		if a[i].endswith('B' + '.' * _):
			print('B')
			sys.exit(0)


l = []
for i in range(8):
	l.append(input())
na = 8
for i in range(8):
	for j in range(8):
		if l[i][j] == 'W':
			k = i - 1
			while k >= 0 and l[k][j] == '.':
				k = k - 1
			if k < 0:
				na = i
				break
	if na != 8:
		break
nb = 8
for i in range(7, -1, -1):
	for j in range(8):
		if l[i][j] == 'B':
			k = i + 1
			while k <= 7 and l[k][j] == '.':
				k = k + 1
			if k > 7:
				nb = 7 - i
				break
	if nb != 8:
		break
if na <= nb:
	print('A')
else:
	print('B')


board = [input().strip() for r in range(8)]
white = 9
for c in range(8):
	for r in range(8):
		ch = board[r][c]
		if ch == 'B':
			break
		if ch == 'W':
			white = min(white, r)
			break
black = 9
for c in range(8):
	for r in range(7, -1, -1):
		ch = board[r][c]
		if ch == 'W':
			break
		if ch == 'B':
			black = min(black, 7 - r)
			break
if white <= black:
	print('A')
else:
	print('B')


a = []
for i in range(8):
	a.append(input())
minB = 100
for row in range(8):
	for column in range(8):
		if a[row][column] == 'B':
			if 7 - row < minB:
				true = False
				for whiteRow in range(row + 1, 8):
					if a[whiteRow][column] == 'W':
						true = True
				if not true:
					minB = 7 - row
minA = 100
for row in range(8):
	for column in range(8):
		if a[row][column] == 'W':
			if row < minA:
				true = False
				for blackRow in range(row - 1, -1, -1):
					if a[blackRow][column] == 'B':
						true = True
				if not true:
					minA = row
if minA > minB:
	print('B')
else:
	print('A')


a = []
for i in range(8):
	a.append(input())
A = []
B = []
for i in range(8):
	for j in range(8):
		if a[i][j] == 'B':
			B.append([i, j])
		elif a[i][j] == 'W':
			A.append([i, j])
a1 = set()
b1 = set()
for i in A:
	fl = True
	for j in B:
		if i[1] == j[1] and i[0] > j[0]:
			fl = False
			break
	if fl:
		a1.add(i[0])
for i in B:
	fl = True
	for j in A:
		if i[1] == j[1] and i[0] < j[0]:
			fl = False
			break
	if fl:
		b1.add(7 - i[0])
if min(a1 | b1) in a1:
	print('A')
else:
	print('B')


cells = [input() for i in range(8)]
min_w = 9
min_b = 9
for i in range(8):
	w = 0
	b = 0
	for j in range(7, -1, -1):
		if cells[j][i] == 'W':
			w += 1
		elif cells[j][i] == 'B' and w == 0:
			min_b = min(min_b, 7 - j)
	for j in range(8):
		if cells[j][i] == 'B':
			b += 1
		if cells[j][i] == 'W' and b == 0:
			min_w = min(min_w, j)
if min_b < min_w:
	print('B')
else:
	print('A')


import copy
import sys

def cuenta(tablero, letra):
	minimo = 10
	for i in range(0, 8):
		for j in range(0, 8):
			if tablero[i][j] == letra:
				k = i - 1
				while k >= 0:
					if tablero[k][j] != '.':
						break
					k -= 1
				if k < 0:
					minimo = min(minimo, i)
	return minimo
tablero = []
for i in range(1, 9):
	line = input()
	tablero.append(line)
A = cuenta(tablero, 'W')
for i in range(0, 4):
	aux = copy.copy(tablero[i])
	tablero[i] = copy.copy(tablero[8 - i - 1])
	tablero[8 - i - 1] = aux
B = cuenta(tablero, 'B')
if A <= B:
	print('A')
else:
	print('B')


p = []
for i in range(8):
	p.append(list(input()))
minb = 999999999
minch = 999999999
for i in range(8):
	for t in range(8):
		if p[i][t] == 'W':
			s = 0
			for e in range(i - 1, -1, -1):
				if p[e][t] != '.':
					s = 999999
				else:
					s += 1
			minb = min(minb, s)
		elif p[i][t] == 'B':
			s = 0
			for e in range(i + 1, 8):
				if p[e][t] != '.':
					s = 999999
				else:
					s += 1
			minch = min(minch, s)
if minb <= minch:
	print('A')
else:
	print('B')


board = []
for i in range(8):
	board.append(input().strip())
R = 8
C = 8
N = 8

def yieldColumns(board):
	for i in range(8):
		A = []
		for j in range(8):
			A.append(board[j][i])
		yield A

def countDict(A):
	d = {}
	d['W'] = 0
	d['B'] = 0
	for l in A:
		if l not in d:
			d[l] = 0
		d[l] += 1
	return d

def whiteWinIn(c):
	isW = False
	count = 0
	for i in range(len(c)):
		j = 7 - i
		if c[j] == 'W':
			isW = True
			count = 0
		if c[j] == 'B':
			isW = False
		if isW and i == 7:
			return count
		count += 1
	return -1

def blackWinIn(c):
	isW = False
	count = 0
	for i in range(len(c)):
		j = i
		if c[j] == 'B':
			isW = True
			count = 0
		if c[j] == 'W':
			isW = False
		if isW and i == 7:
			return count
		count += 1
	return -1

def solve(board):
	wWin = 10000000000.0
	bWin = 10000000000.0
	for c in yieldColumns(board):
		w = whiteWinIn(c)
		if w != -1:
			wWin = min(w, wWin)
		b = blackWinIn(c)
		if b != -1:
			bWin = min(b, bWin)
	if wWin <= bWin:
		return 'A'
	else:
		return 'B'
print(solve(board))


board = [input(), input(), input(), input(), input(), input(), input(), input()]
b = -99
for i in range(8):
	for j in range(7, -1, -1):
		piece = board[j][i]
		if piece == 'W':
			break
		if piece == 'B':
			b = max(b, j)
			break
b = 7 - b
w = 99
for i in range(8):
	for j in range(8):
		piece = board[j][i]
		if piece == 'B':
			break
		if piece == 'W':
			w = min(w, j)
if b < w:
	print('B')
else:
	print('A')


a = []
for i in range(8):
	a.append(input())
ans = (100, 'C')
for i in range(8):
	for j in range(8):
		if a[i][j] == 'W':
			st = True
			for k in range(i):
				if a[k][j] == 'B':
					st = False
			if st:
				if i < ans[0]:
					ans = (i, 'A')
for i in range(8):
	for j in range(8):
		if a[i][j] == 'B':
			st = True
			for k in range(i + 1, 8):
				if a[k][j] == 'W':
					st = False
			if st:
				if 8 - i - 1 < ans[0]:
					ans = (8 - i - 1, 'B')
print(ans[1])


def MaxB(matrix, row, column) -> int:
	cnt = 0
	for i in range(row + 1, 8):
		if matrix[i][column] != '.':
			return 9
		else:
			cnt += 1
	return cnt

def MaxA(matrix, row, column) -> int:
	cnt = 0
	for i in range(row - 1, -1, -1):
		if matrix[i][column] != '.':
			return 9
		else:
			cnt += 1
	return cnt
n = 8
l = []
while n != 0:
	s = input()
	l.append(list(s))
	n -= 1
Ma = 9
Mb = 9
for i in range(0, 8):
	for j in range(0, 8):
		if l[i][j] == 'B':
			Mb = min(Mb, MaxB(l, i, j))
		elif l[i][j] == 'W':
			Ma = min(Ma, MaxA(l, i, j))
if Ma <= Mb:
	print('A')
else:
	print('B')


from sys import stdin
linecount = 8
field = []

def move_count(row, column, direction):
	if direction == 1:
		last = linecount
	else:
		last = -1
	count = 0
	for i in range(row + direction, last, direction):
		if field[i][c] != '.':
			return linecount
		else:
			count += 1
	return count
for i in range(0, linecount):
	field.append(list(stdin.readline().strip()))
a_moves = linecount
b_moves = linecount
for r in range(0, linecount):
	for c in range(0, linecount):
		if field[r][c] == 'W':
			count = move_count(r, c, -1)
			if count < a_moves:
				a_moves = count
		elif field[r][c] == 'B':
			count = move_count(r, c, 1)
			if count < b_moves:
				b_moves = count
if a_moves <= b_moves:
	print('A')
else:
	print('B')


def up(r, c):
	assert board[r][c] == 'W'
	ans = r
	while r >= 0:
		if board[r][c] == 'B':
			return 9
		r -= 1
	else:
		return ans

def down(r, c):
	assert board[r][c] == 'B'
	ans = 7 - r
	while r < 8:
		if board[r][c] == 'W':
			return 9
		r += 1
	else:
		return ans
(white, black) = (9, 9)
board = [input() for _ in range(8)]
for r in range(8):
	for c in range(8):
		if board[r][c] == 'W':
			white = min(white, up(r, c))
		elif board[r][c] == 'B':
			black = min(black, down(r, c))
assert white != 9 or black != 9
print('A' if white <= black else 'B')


board = {}
for i in range(1, 9):
	row = input()
	for j in range(1, 9):
		board[i, j] = row[j - 1]
INF = 21
bestw = INF
bestb = INF
for c in range(1, 9):
	bb = INF
	bw = INF
	for r in range(1, 9):
		if board[r, c] == 'B':
			bb = min(bb, 8 - r)
		elif board[r, c] == 'W':
			bb = INF
	bpresent = False
	for r in range(1, 9):
		if board[r, c] == 'B':
			bpresent = True
		elif board[r, c] == 'W' and (not bpresent):
			bw = min(bw, r - 1)
	bestw = min(bestw, bw)
	bestb = min(bestb, bb)
if bestw <= bestb:
	print('A')
else:
	print('B')


S = [input() for _ in range(8)]
S = list((''.join(x) for x in zip(*S)))
bdist = 1000
wdist = 1000
for s in S:
	if 'B' in s:
		x = 8 - s.rfind('B')
		y = 8 - s.rfind('W')
		if x < y:
			bdist = min(bdist, x)
	if 'W' in s:
		x = 8 - s[::-1].rfind('W')
		y = 8 - s[::-1].rfind('B')
		if x < y:
			wdist = min(wdist, x)
if bdist < wdist:
	print('B')
else:
	print('A')


import math
from decimal import *
import sys
S = set()
mw = 100
mb = 100
B = []
for i in range(0, 8):
	A = input()
	B.append(A)
	for j in range(0, 8):
		k = A[j]
		if k == 'W' and j not in S:
			if i < mw:
				mw = i
			S.add(j)
		if k == 'B' and j not in S:
			S.add(j)
D = set()
for i in range(0, 8):
	A = B[7 - i]
	for j in range(0, 8):
		k = A[j]
		if k == 'B' and j not in D:
			if i < mb:
				mb = i
			D.add(j)
		if k == 'W' and j not in D:
			D.add(j)
if mw <= mb:
	print('A')
else:
	print('B')


import sys
from sys import stdin, stdout
chess = []
for i in range(8):
	chess.append([x for x in stdin.readline().rstrip().split()])
white_dist = []
black_dist = []
for i in range(8):
	for j in range(8):
		if chess[i][0][j] == 'W':
			is_black_above = False
			for k in range(0, i):
				if chess[k][0][j] == 'B':
					is_black_above = True
			if not is_black_above:
				white_dist.append(i)
		if chess[i][0][j] == 'B':
			is_white_below = False
			for k in range(i + 1, 8):
				if chess[k][0][j] == 'W':
					is_white_below = True
			if not is_white_below:
				black_dist.append(7 - i)
if min(white_dist) <= min(black_dist):
	stdout.write('A\n')
else:
	stdout.write('B\n')


arr = [0] * 8
for i in range(8):
	arr[i] = input()
(wr, wc, br, bc) = [[], [], [], []]
for i in range(8):
	for j in range(8):
		if arr[i][j] == 'B':
			bc.append(j)
			br.append(i)
		if arr[i][j] == 'W':
			wc.append(j)
			wr.append(i)
bl = len(bc)
wl = len(wc)
wf = 8
bf = 8
for i in range(bl - 1, -1, -1):
	c = bc[i]
	temp = 0
	for j in range(7, -1, -1):
		if arr[j][c] == 'W':
			temp = j
			break
	if temp > br[i]:
		continue
	bf = 7 - br[i]
	break
for i in range(wl):
	c = wc[i]
	temp = 8
	for j in range(8):
		if arr[j][c] == 'B':
			temp = j
			break
	if temp < wr[i]:
		continue
	wf = wr[i]
	break
if bf < wf:
	print('B')
else:
	print('A')


s = [[0 for x in range(8)] for y in range(8)]
for i in range(8):
	s[i] = list(input())
arr = []
arr = list(map(list, zip(*s)))
white = 7
black = 7
for i in range(8):
	if 'W' in arr[i]:
		if 'B' not in arr[i][:arr[i].index('W')]:
			white = min(white, arr[i].index('W'))
	if 'B' in arr[i]:
		if 'W' not in arr[i][::-1][:arr[i][::-1].index('B')]:
			black = min(black, arr[i][::-1].index('B'))
if white > black:
	print('B')
else:
	print('A')


k = []
for i in range(8):
	k.append(input())
(w, b) = (8, 8)
for c in range(8):
	wv = None
	bl = -1
	for r in range(8):
		if k[r][c] == 'B':
			bl = r
			if wv == None:
				wv = False
		if k[r][c] == 'W':
			bl = -1
			if wv == None:
				wv = True
				wn = r
	if wv:
		w = min(w, wn)
	b = min(b, 7 - bl)
if b >= w:
	print('A')
else:
	print('B')


l = []
B = []
W = []
for i in range(8):
	l1 = input()
	l.append(l1)
	for j in range(8):
		if l[i][j] == 'B':
			B.append([i, j])
		if l[i][j] == 'W':
			W.append([i, j])
B1 = len(B)
W1 = len(W)
(p, q) = ([], [])
for i in range(B1):
	j = B[i][0]
	k = B[i][1]
	if j == 7:
		q.append(0)
		break
	r = j
	j += 1
	while 1:
		if j == 7 and l[j][k] != 'W':
			p.append(8 - r - 1)
			break
		if l[j][k] == 'W':
			break
		j += 1
for i in range(W1):
	j = W[i][0]
	k = W[i][1]
	if j == 0:
		q.append(0)
		break
	r = j
	j -= 1
	while 1:
		if j == 0 and l[j][k] != 'B':
			q.append(r)
			break
		if l[j][k] == 'B':
			break
		j -= 1
if len(p) > 0:
	p1 = min(p)
else:
	p1 = 9
if len(q) > 0:
	q1 = min(q)
else:
	q1 = 9
if q1 > p1:
	print('B')
else:
	print('A')


import math as mt
import sys, string
input = sys.stdin.readline
import random
import collections
from heapq import heappush, heapify, heappop
L = lambda : list(map(int, input().split()))
Ls = lambda : list(input().split())
M = lambda : map(int, input().split())
I = lambda : int(input())
l = []
for i in range(8):
	s = input()
	s = list(s)
	l.append(s)
x = []
p = 10 ** 10
q = 10 ** 10
for i in range(8):
	for j in range(8):
		if l[j][i] == 'B':
			break
		if l[j][i] == 'W':
			p = min(p, j)
			break
for i in range(8):
	for j in range(7, -1, -1):
		if l[j][i] == 'W':
			break
		if l[j][i] == 'B':
			q = min(q, 7 - j)
if p <= q:
	print('A')
else:
	print('B')


table = []
for _ in range(8):
	table.append(input())
ocrA = []
ocrB = []
A = 8
B = 8
import re
for i in range(8):
	for j in range(8):
		if table[i][j] == 'W':
			ocrA.append(j)
		elif table[i][j] == 'B':
			ocrB.append(j)
	while ocrA != []:
		asteps = 0
		for j in range(i - 1, -1, -1):
			if table[j][ocrA[0]] != '.':
				asteps = -1
				break
			asteps += 1
		if asteps != -1 and asteps < A:
			A = asteps
		ocrA.pop(0)
	while ocrB != []:
		bsteps = 0
		for j in range(i + 1, 8):
			if table[j][ocrB[0]] != '.':
				bsteps = -1
				break
			bsteps += 1
		if bsteps != -1 and bsteps < B:
			B = bsteps
		ocrB.pop(0)
if A <= B:
	print('A')
else:
	print('B')


N = 8
a = [list(input()) for i in range(N)]
amin = N
bmin = N
for c in range(8):
	r = 0
	while r < N and a[r][c] == '.':
		r += 1
	if r < N and a[r][c] == 'W':
		amin = min(amin, r)
	r = N - 1
	while r >= 0 and a[r][c] == '.':
		r -= 1
	if r >= 0 and a[r][c] == 'B':
		bmin = min(bmin, N - 1 - r)
if amin <= bmin:
	print('A')
else:
	print('B')


M = [input() for i in range(8)]
l = []
p = 100000000
for i in range(8):
	for j in range(8):
		if M[i][j] == 'W' and j not in l:
			p = i
			break
		if M[i][j] == 'B':
			l.append(j)
	if p != 100000000:
		break
l = []
for i in range(7, -1, -1):
	for j in range(7, -1, -1):
		if M[i][j] == 'B' and j not in l:
			if p <= 8 - i - 1:
				print('A')
			else:
				print('B')
			exit()
		if M[i][j] == 'W':
			l.append(j)
print('A')


__author__ = 'Suvasish'
lst = []
a_row = 7
b_row = 0
b_lst = []
a_lst = []
for i in range(0, 8):
	lst.append(list(input()))
	if 'W' in lst[i]:
		a_lst.append(i)
	if 'B' in lst[i]:
		b_lst.append(i)
b_lst.reverse()
_break = False
for i in a_lst:
	if _break:
		break
	for l in range(0, 8):
		if _break:
			break
		if lst[i][l] == 'W':
			for j in range(0, i):
				if 'B' in lst[j] and lst[j][l] == 'B':
					break
				elif j == i - 1:
					a_row = i
					_break = True
					break
_break = False
for k in b_lst:
	if _break:
		break
	for m in range(0, 8):
		if _break:
			break
		if lst[k][m] == 'B':
			for n in range(k + 1, 8):
				if 'W' in lst[n] and lst[n][m] == 'W':
					break
				elif n == 7:
					b_row = k
					_break = True
					break
if 7 - b_row < a_row:
	print('B')
else:
	print('A')


grid = [list(input()) for _ in range(8)]
has_black = set()
min_white = 999
for i in range(8):
	for j in range(8):
		if grid[i][j] == 'W':
			if j not in has_black:
				min_white = min(min_white, i)
		elif grid[i][j] == 'B':
			has_black.add(j)
has_white = set()
min_black = 999
for i in reversed(range(8)):
	for j in range(8):
		if grid[i][j] == 'W':
			has_white.add(j)
		elif grid[i][j] == 'B':
			if j not in has_white:
				min_black = min(min_black, 8 - i - 1)
if min_white <= min_black:
	print('A')
else:
	print('B')


l_w = [9] * 8
l_b = [9] * 8
for y in range(8):
	i = 0
	for c in input():
		if c == 'W':
			if l_b[i] == 9 and l_w[i] == 9:
				l_w[i] = y
			l_b[i] = 10
		elif c == 'B':
			l_b[i] = 7 - y
		i += 1
min_w = min(l_w)
min_b = min(l_b)
if min_w > min_b:
	print('B')
else:
	print('A')


def STR():
	return list(input())

def INT():
	return int(input())

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

def MAP2():
	return map(float, input().split())

def LIST():
	return list(map(int, input().split()))

def STRING():
	return input()
from heapq import heappop, heappush
from bisect import *
from collections import deque, Counter
from math import *
from itertools import permutations, accumulate
dx = [-1, 1, 0, 0]
dy = [0, 0, 1, -1]
grid = []
for i in range(8):
	s = STR()
	grid.append(s)
r1 = []
r2 = []
for i in range(8):
	for j in range(8):
		flag = True
		if grid[i][j] == 'W':
			for k in range(0, i):
				if grid[k][j] == 'B':
					flag = False
					break
			if flag:
				r1.append(i - 0)
		elif grid[i][j] == 'B':
			for k in range(i + 1, 8):
				if grid[k][j] == 'W':
					flag = False
					break
			if flag:
				r2.append(7 - i)
r1.sort()
r2.sort()
if len(r1) == 0:
	print('B')
	exit(0)
if len(r2) == 0:
	print('A')
	exit(0)
if r1[0] <= r2[0]:
	print('A')
else:
	print('B')


ch = [1, 2, 3, 4, 5, 6, 7, 8]
a = 7
b = 7
for i in range(8):
	ch[i] = list(input())
for j in range(8):
	for k in range(8):
		if ch[k][j] == 'W':
			if k < a:
				tempa = a
				a = 0
				while k:
					if ch[k - 1][j] == '.':
						k -= 1
						a += 1
					else:
						a = tempa
						break
		if ch[k][j] == 'B':
			if 7 - k < b:
				tempb = b
				b = 0
				while k != 7:
					if ch[k + 1][j] == '.':
						k += 1
						b += 1
					else:
						b = tempb
						break
if a <= b:
	print('A')
else:
	print('B')


data = []
wlist = []
blist = []
for _ in range(8):
	data.append(input())
for i in range(8):
	for j in range(8):
		if data[i][j] == 'W':
			isOk = True
			for k in range(0, i):
				if data[k][j] == 'B':
					isOk = False
					break
			if isOk:
				wlist.append(i)
		elif data[i][j] == 'B':
			isOk = True
			for k in range(i + 1, 8):
				if data[k][j] == 'W':
					isOk = False
					break
			if isOk:
				blist.append(i)
if min(wlist) <= min(map(lambda x: 7 - x, blist)):
	print('A')
else:
	print('B')


f = [input() for _ in range(8)]
(ca, cb) = (8, 8)
for col in range(8):
	for row in range(8):
		if f[row][col] == 'W':
			ca = min(ca, row)
		if f[row][col] != '.':
			break
	for row in range(7, -1, -1):
		if f[row][col] == 'B':
			cb = min(cb, 7 - row)
		if f[row][col] != '.':
			break
print('A' if ca <= cb else 'B')


white = 7
black = 0
data = []
for i in range(8):
	data.append(input().strip())
for i in range(8):
	for j in range(8):
		flag = False
		if data[i][j] == 'W':
			for k in range(i):
				if data[k][j] == 'B':
					flag = True
					break
			if not flag:
				white = min(white, i)
		if data[i][j] == 'B':
			for k in range(i + 1, 8):
				if data[k][j] == 'W':
					flag = True
					break
			if not flag:
				black = max(black, i)
black = 7 - black
if white <= black:
	print('A')
else:
	print('B')


W = float('inf')
B = float('inf')
OB = [None in range(8)]
OK = [None in range(8)]
Board = []
for i in range(8):
	L = [s for s in input()]
	Board.append(L)
for i in range(8):
	index = 0
	bool = True
	while index < 8 and bool:
		if Board[index][i] == 'B':
			bool = False
		elif Board[index][i] == 'W':
			W = min(W, index)
			bool = False
		else:
			index += 1
for i in range(8):
	index = 0
	bool = True
	while index < 8 and bool:
		if Board[7 - index][i] == 'W':
			bool = False
		elif Board[7 - index][i] == 'B':
			B = min(B, index)
			bool = False
		else:
			index += 1
if B < W:
	print('B')
else:
	print('A')


field = [list(input()) for i in range(8)]
for y in range(8):
	for x in range(y + 1, 8):
		(field[x][y], field[y][x]) = (field[y][x], field[x][y])
minW = 1000
minB = 1000
for row in range(8):
	w = None
	for col in range(7, -1, -1):
		if field[row][col] == 'W':
			w = col
	if w != None and 'B' not in field[row][:w]:
		minW = min(minW, w)
	b = None
	for col in range(8):
		if field[row][col] == 'B':
			b = col
	if b != None and 'W' not in field[row][b:]:
		minB = min(minB, 7 - b)
if minB < minW:
	print('B')
else:
	print('A')


from sys import stdin
s = []
w = 9
b = 9
w1 = []
b1 = []
s1 = []
for i in range(8):
	s = stdin.readline().strip()
	s1.append(s)
	for j in range(8):
		if 'W' == s[j] and j not in b1:
			w = min(w, i)
		if 'B' == s[j]:
			b1.append(j)
s1.reverse()
for i in range(8):
	s = s1[i]
	for j in range(8):
		if 'B' == s[j] and j not in w1:
			b = min(b, i)
		if 'W' == s[j]:
			w1.append(j)
if w <= b:
	print('A')
else:
	print('B')


our = [input() for i in range(8)]
resA = 100
resB = 100
for i in range(8):
	for j in range(8):
		if our[i][j] == 'W':
			curr = i
			while curr > 0 and our[curr - 1][j] == '.':
				curr -= 1
			if curr == 0:
				resA = min(resA, i)
		elif our[i][j] == 'B':
			curr = i
			while curr < 7 and our[curr + 1][j] == '.':
				curr += 1
			if curr == 7:
				resB = min(resB, curr - i)
if resA <= resB:
	print('A')
else:
	print('B')


a = []
for i in range(8):
	st = input()
	row = list(st)
	a.append(row)
highwhite = 10
for c in range(8):
	r = 0
	done = False
	while r < 8 and (not done):
		if a[r][c] == 'B':
			done = True
		elif a[r][c] == 'W':
			done = True
			if r < highwhite:
				highwhite = r
		r += 1
lowblack = -10
for c in range(8):
	r = 7
	done = False
	while r >= 0 and (not done):
		if a[r][c] == 'W':
			done = True
		elif a[r][c] == 'B':
			done = True
			if r > lowblack:
				lowblack = r
		r -= 1
if highwhite == 10:
	print('B')
elif lowblack == -10:
	print('A')
else:
	blackmoves = 7 - lowblack
	if highwhite <= blackmoves:
		print('A')
	else:
		print('B')


field = []

def check_row(x, y, choise):
	if choise:
		for i in range(x):
			if field[i][y] == 'B':
				return False
		return True
	else:
		i = 7
		while i != x:
			if field[i][y] == 'W':
				return False
			i -= 1
		return True

def find_best_w():
	for i in range(8):
		if 'W' in field[i]:
			for j in range(len(field[i])):
				if field[i][j] == 'W':
					if check_row(i, j, True):
						return i

def find_best_b():
	i = 7
	while i != -1:
		if 'B' in field[i]:
			for j in range(len(field[i])):
				if field[i][j] == 'B':
					if check_row(i, j, False):
						return i
		i -= 1

def solution():
	for i in range(8):
		field.append(input())
	return find_best_w() - 1 < 7 - find_best_b()
print('A' if solution() else 'B', end='')


def read_data():
	maps = [input() for n in range(8)]
	return maps

def decode(maps):
	step_b = 1000
	step_a = 1000
	for col in range(8):
		(mina, maxa) = find_range(maps, col, 'W')
		(minb, maxb) = find_range(maps, col, 'B')
		if mina < minb:
			step_a = min(step_a, mina)
		if maxb > maxa:
			step_b = min(step_b, 7 - maxb)
	if step_a <= step_b:
		return 'A'
	else:
		return 'B'

def find_range(maps, col, ch):
	minc = float('inf')
	maxc = -float('inf')
	for row in range(8):
		if maps[row][col] == ch:
			minc = min(minc, row)
			maxc = max(maxc, row)
	return (minc, maxc)
maps = read_data()
print(decode(maps))


w = []
b = []
board = []

def check(i, j):
	for k in range(i - 1, -1, -1):
		if board[k][j] != '.':
			return False
	return True

def check2(i, j):
	for k in range(i + 1, 8):
		if board[k][j] != '.':
			return False
	return True
for i in range(8):
	line = input()
	board.append(line)
	for (j, c) in enumerate(line):
		if c == 'B':
			b.append((i, j))
		if c == 'W':
			w.append((i, j))
for i in range(7, -1, -1):
	for j in range(8):
		if board[i][j] == 'W' and check(i, j):
			mymin = i
for i in range(8):
	for j in range(8):
		if board[i][j] == 'B' and check2(i, j):
			mymin2 = 8 - i - 1
if mymin <= mymin2:
	print('A')
else:
	print('B')


field = [input() for i in range(8)]
field = [[field[y][x] for y in range(8)] for x in range(8)]
wa = float('+inf')
wb = float('+inf')
for row in field:
	row = ''.join(row)
	if 'W' in row:
		if 'B' in row and row.index('W') > row.index('B'):
			pass
		else:
			nwa = row.index('W')
			wa = min(wa, nwa)
	if 'B' in row:
		if 'W' in row and row.rindex('W') > row.rindex('B'):
			pass
		else:
			nwb = 7 - row.rindex('B')
			wb = min(wb, nwb)
if wa <= wb:
	print('A')
else:
	print('B')


from sys import stdin
an = []
aw = []
ab = []
for i in range(0, 8):
	an.append(stdin.readline())
for i in range(0, 8):
	for j in range(0, 8):
		if an[j][i] == 'W':
			aw.append(j)
			break
		if an[j][i] == 'B':
			break
for i in range(7, -1, -1):
	for j in range(7, -1, -1):
		if an[j][i] == 'B':
			ab.append(8 - j - 1)
			break
		if an[j][i] == 'W':
			break
if not aw:
	print('B')
	exit()
if not ab:
	print('A')
	exit()
maw = min(aw)
mab = min(ab)
print('A' if maw <= mab else 'B')


(g, v) = ([input() for i in range(8)], [8, 8])
for i in range(8):
	for j in range(8):
		if g[i][j] == 'W' and all((g[k][j] == '.' for k in range(i))):
			v[0] = min(v[0], i)
		elif g[i][j] == 'B' and all((g[k][j] == '.' for k in range(i + 1, 8))):
			v[1] = min(v[1], 7 - i)
print('A' if v[0] <= v[1] else 'B')


l = []
s = ''
f = []
for i in range(8):
	l.append(input())
for i in range(8):
	s = ''
	for j in range(8):
		s = s + l[j][i]
	f.append(s)
minw = 999
minb = -999
cw = 999
cb = 999
for i in range(8):
	if 'W' in f[i] and 'B' in f[i]:
		a = f[i].index('W')
		b = f[i].index('B')
		f[i] = f[i][::-1]
		c = f[i].index('W')
		d = f[i].index('B')
		c = 7 - c
		d = 7 - d
		if a < b and minw > a:
			minw = a
		if d > c and minb < d:
			minb = d
	elif 'W' in f[i]:
		if minw > f[i].index('W'):
			minw = f[i].index('W')
	elif 'B' in f[i]:
		f[i] = f[i][::-1]
		if minb < 7 - f[i].index('B'):
			minb = 7 - f[i].index('B')
if minw == 7 - minb:
	print('A')
elif minw < 7 - minb:
	print('A')
else:
	print('B')


rows = [list(input()) for x in range(8)]
columns = [[x[y] for x in rows] for y in range(8)]
a = 8
for x in range(8):
	c = rows[x]
	condition = False
	if 'W' in c:
		for y in range(8):
			if c[y] == 'W':
				r = columns[y][:x]
				condition = True
				for z in r:
					if not z == '.':
						condition = False
						break
				if condition:
					break
	if condition:
		a = x
		break
b = 8
for x in range(7, -1, -1):
	c = rows[x]
	condition = False
	if 'B' in c:
		for y in range(8):
			if c[y] == 'B':
				r = columns[y][x + 1:]
				condition = True
				for z in r:
					if not z == '.':
						condition = False
						break
				if condition:
					break
	if condition:
		b = 7 - x
		break
if b < a:
	print('B')
else:
	print('A')


import sys

def main():
	stdin = sys.stdin.read().split('\n')
	(A, B) = ([], [])
	for row in range(8):
		for col in range(8):
			if stdin[row][col] == 'W':
				A.append((row, col))
			if stdin[row][col] == 'B':
				B.append((row, col))
	Acount = []
	for a in A:
		if all((stdin[i][a[1]] == '.' for i in range(a[0]))):
			Acount.append(a[0])
	Bcount = []
	for b in B:
		if all((stdin[i][b[1]] == '.' for i in range(b[0] + 1, 8))):
			Bcount.append(7 - b[0])
	if min(Acount) <= min(Bcount):
		print('A')
	else:
		print('B')

def __starting_point():
	main()
__starting_point()


grid = [list(input()) for i in range(8)]
b = 9
w = 9
tblock = False
bblock = False
for r in range(8):
	for c in range(8):
		for ri in range(r):
			if grid[ri][c] == 'B':
				tblock = True
		for ri in range(r + 1, 8):
			if grid[ri][c] == 'W':
				bblock = True
		if grid[r][c] == 'B' and (not bblock):
			b = min([abs(7 - r), b])
		elif grid[r][c] == 'W' and (not tblock):
			w = min([w, r])
		tblock = False
		bblock = False
if b < w:
	print('B')
else:
	print('A')


l = []
for i in range(8):
	x = input()
	l.append(x)
bl = [10 for i in range(8)]
wh = [10 for i in range(8)]
for i in range(8):
	for j in range(8):
		if l[i][j] == 'B' and bl[j] == 10:
			bl[j] = i
		if l[i][j] == 'W' and wh[j] == 10:
			wh[j] = i
a = 10
for i in range(8):
	if wh[i] < 10:
		if wh[i] < bl[i]:
			a = min(a, wh[i])
bl = [10 for i in range(8)]
wh = [-1 for i in range(8)]
for i in range(7, -1, -1):
	for j in range(8):
		if l[i][j] == 'B' and bl[j] == 10:
			bl[j] = i
		if l[i][j] == 'W' and wh[j] == -1:
			wh[j] = i
b = -1
for i in range(8):
	if bl[i] < 10:
		if bl[i] > wh[i] and wh[i] != 10:
			b = max(b, bl[i])
bb = 7 - b
aa = a
if aa <= bb:
	print('A')
else:
	print('B')


b = [100 for i in range(8)]
w = [100 for i in range(8)]
b_temp = 0
w_temp = 0
b_min = 0
w_min = 0
field = ['' for i in range(8)]
for i in range(8):
	field[i] = input()
for i in range(8):
	for j in range(8):
		w_temp += 1
		if field[j][i] == 'B':
			w_temp = 100
		if field[j][i] == 'W' and w_temp < 100:
			w[i] = w_temp
			w_temp = 100
	w_temp = 0
for i in range(8):
	for j in range(8):
		b_temp += 1
		if field[7 - j][i] == 'W':
			b_temp = 100
		if field[7 - j][i] == 'B' and b_temp < 100:
			b[i] = b_temp
			b_temp = 100
	b_temp = 0
b_min = min(b)
w_min = min(w)
if b_min < w_min:
	print('B')
else:
	print('A')


def free_way(p, i, j, dir):
	if dir == -1:
		if i == 0:
			return True
		i -= 1
		while i >= 0:
			if not p[i][j] is '.':
				return False
			i -= 1
		return True
	if dir == 1:
		if i == 7:
			return True
		i += 1
		while i <= 7:
			if p[i][j] != '.':
				return False
			i += 1
		return True
p = []
r = 0
while r < 8:
	r += 1
	tmp = input()
	p.append(tmp)
(move_a, move_b) = (10, 10)
i = -1
while i < 7:
	i += 1
	j = -1
	while j < 7:
		j += 1
		if p[i][j] == 'W' and free_way(p, i, j, -1):
			move_a = i
			break
	if move_a != 10:
		break
i = 8
while i > 0:
	i -= 1
	j = -1
	while j < 7:
		j += 1
		if p[i][j] == 'B' and free_way(p, i, j, 1):
			move_b = 7 - i
			break
	if move_b != 10:
		break
if move_a <= move_b:
	print('A')
else:
	print('B')


grid = []
for i in range(8):
	grid.append(input())
w_result = b_result = 8
for j in range(8):
	pos_w = pos_b = 8
	for i in range(8):
		if grid[i][j] != '.':
			if grid[i][j] == 'W':
				pos_w = i
			break
	for i in range(7, -1, -1):
		if grid[i][j] != '.':
			if grid[i][j] == 'B':
				pos_b = i
			break
	if pos_w < 8:
		w_result = min(w_result, pos_w)
	if pos_b < 8:
		b_result = min(b_result, 7 - pos_b)
print('A' if w_result <= b_result else 'B')


cin = input
a = [cin() for i in range(8)]
(mw, mb) = (8, 8)
for c in range(8):
	for r in range(8):
		if a[r][c] == 'W':
			mw = min(mw, r)
		if a[r][c] != '.':
			break
	for r in range(7, -1, -1):
		if a[r][c] == 'B':
			mb = min(mb, 7 - r)
		if a[r][c] != '.':
			break
print('AB'[mb < mw])


s = []
w = 9
b = 9
w1 = []
b1 = []
s1 = []
for i in range(8):
	s = input().strip()
	s1.append(s)
	for j in range(8):
		if 'W' == s[j] and j not in b1:
			w = min(w, i)
		if 'B' == s[j]:
			b1.append(j)
s1 = s1[::-1]
for i in range(8):
	s = s1[i]
	for j in range(8):
		if 'B' == s[j] and j not in w1:
			b = min(b, i)
		if 'W' == s[j]:
			w1.append(j)
if w <= b:
	print('A')
else:
	print('B')


matrix = list()
for i in range(8):
	matrix.append(input())
(minb, mina) = (9, 9)
for j in range(8):
	for i in range(8):
		if matrix[i][j] != '.':
			if matrix[i][j] == 'W':
				mina = min(mina, i)
			break
	for i in range(7, -1, -1):
		if matrix[i][j] != '.':
			if matrix[i][j] == 'B':
				minb = min(minb, 7 - i)
			break
if mina > minb:
	print('B')
else:
	print('A')


B = ['.' for x in range(8)]
W = ['.' for x in range(8)]
L = []
for i in range(8):
	ch = input()
	ch = list(ch)
	L.append(ch)
for i in range(len(L)):
	for j in range(8):
		if B[j] == '.' and L[i][j] != '.':
			B[j] = L[i][j]
for i in range(len(L) - 1, -1, -1):
	for j in range(8):
		if W[j] == '.' and L[i][j] != '.':
			W[j] = L[i][j]
(b, w) = (9, 9)
for i in range(8):
	C = False
	for j in range(8):
		if L[i][j] == 'W' and B[j] != 'B':
			C = True
			break
	if C:
		if i < w:
			w = i
for i in range(7, -1, -1):
	C = False
	for j in range(8):
		if L[i][j] == 'B' and W[j] != 'W':
			C = True
			break
	if C:
		if 7 - i < b:
			b = 7 - i
if w <= b:
	print('A')
else:
	print('B')


A = [input() for i in range(8)]
B = 9
W = 9
for i in range(8):
	for j in range(8):
		if A[j][i] == 'W':
			W = min(W, j)
			break
		if A[j][i] == 'B':
			break
	for j in range(7, -1, -1):
		if A[j][i] == 'B':
			B = min(B, 8 - j)
			break
		if A[j][i] == 'W':
			break
if B <= W:
	print('B')
else:
	print('A')


(white, black) = ([set() for _ in range(8)], [set() for _ in range(8)])
for row in range(8):
	for (col, c) in enumerate(input().strip()):
		if c == 'W':
			white[col].add(row)
		elif c == 'B':
			black[col].add(row)
(min_w, max_b) = (7, 0)
for col in range(8):
	for w in white[col]:
		if all((b > w for b in black[col])) and w < min_w:
			min_w = w
	for b in black[col]:
		if all((b > w for w in white[col])) and b > max_b:
			max_b = b
if min_w <= 7 - max_b:
	print('A')
else:
	print('B')


a = [input() for i in range(8)]
(ca, cb) = (8, 8)
for j in range(8):
	for i in range(8):
		if a[i][j] == 'W':
			ca = min(ca, i)
		if a[i][j] != '.':
			break
for j in range(8):
	for i in range(7, -1, -1):
		if a[i][j] == 'B':
			cb = min(cb, 7 - i)
		if a[i][j] != '.':
			break
print('A' if ca <= cb else 'B')


from sys import stdin
chessTable = []
for i in range(8):
	chessTable.append(stdin.readline())
whiteBest = {}
whiteBlocked = {}
blackBest = {}
blackBlocked = {}
for (row_index, row_iterator) in enumerate(chessTable):
	for (column_index, column_iterator) in enumerate(row_iterator):
		if column_iterator == 'B':
			whiteBlocked[column_index] = row_index
		if column_iterator == 'W' and column_index not in whiteBlocked:
			whiteBest[column_index] = row_index
			if 'white' not in globals():
				white = row_index
for it in reversed(range(8)):
	row_iterator = chessTable[it]
	row_index = it
	for (column_index, column_iterator) in enumerate(row_iterator):
		if column_iterator == 'W':
			blackBlocked[column_index] = row_index
		if column_iterator == 'B' and column_index not in blackBlocked:
			blackBest[column_index] = row_index
			if 'black' not in globals():
				black = 7 - row_index
if white > black:
	print('B')
else:
	print('A')


arr = []
for i in range(8):
	arr.append(input())
white = black = 0
for i in range(1, 8):
	for j in range(8):
		if arr[i][j] == 'W':
			check = 0
			for k in range(i):
				if arr[k][j] != '.':
					check = 1
					break
			if check == 0:
				white = i
				break
	if white:
		break
for i in range(-2, -9, -1):
	for j in range(8):
		if arr[i][j] == 'B':
			check = 0
			for k in range(-1, i, -1):
				if arr[k][j] != '.':
					check = 1
					break
			if check == 0:
				black = 7 - (8 + i)
				break
	if black:
		break
if white == 0 or black == 0:
	if white == 0:
		print('B')
	else:
		print('A')
elif white <= black:
	print('A')
else:
	print('B')


import sys
import os
from io import BytesIO, IOBase
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')
mod = 10 ** 9 + 7

def lcm(x, y):
	return x * y / gcd(x, y)

def fact(x, mod=mod):
	ans = 1
	for i in range(1, x + 1):
		ans = ans * i % mod
	return ans

def arr2D(n, m, default=0):
	return [[default for j in range(m)] for i in range(n)]

def arr3D(n, m, r, default=0):
	return [[[default for k in range(r)] for j in range(m)] for i in range(n)]

def sortDictV(x):
	return {k: v for (k, v) in sorted(x.items(), key=lambda item: item[1])}

class DSU:

	def __init__(self, length):
		self.length = length
		self.parent = [-1] * self.length

	def getParent(self, node, start):
		if node >= self.length:
			return False
		if self.parent[node] < 0:
			if start != node:
				self.parent[start] = node
			return node
		return self.getParent(self.parent[node], start)

	def union(self, node1, node2):
		parent1 = self.getParent(node1, node1)
		parent2 = self.getParent(node2, node2)
		if parent1 == parent2:
			return False
		elif self.parent[parent1] <= self.parent[parent2]:
			self.parent[parent1] += self.parent[parent2]
			self.parent[parent2] = parent1
		else:
			self.parent[parent2] += self.parent[parent1]
			self.parent[parent1] = parent2
		return True

	def getCount(self, node):
		return -self.parent[self.getParent(node, node)]

def exact(num):
	if abs(num - round(num)) <= 10 ** (-9):
		return round(num)
	return num

def solve(lst):
	(W, B) = (float('INF'), float('-INF'))
	for j in range(8):
		for i in range(8):
			if lst[i][j] == 'W':
				W = min(W, i)
				break
			if lst[i][j] == 'B':
				break
	for j in range(8):
		for i in range(7, -1, -1):
			if lst[i][j] == 'B':
				B = max(B, i)
				break
			if lst[i][j] == 'W':
				break
	B = 8 - B - 1
	if B < W:
		return 'B'
	else:
		return 'A'
lst = []
for i in range(8):
	lst.append(list(input()))
print(solve(lst))


a = []
for i in range(8):
	a.append(input())
wmin = 8
bmin = -1
for i in range(8):
	for j in range(8):
		if a[j][i] == 'W':
			wmin = min(wmin, j)
			break
		elif a[j][i] == 'B':
			break
for i in range(8):
	for j in range(7, 0, -1):
		if a[j][i] == 'B':
			bmin = max(bmin, j)
			break
		elif a[j][i] == 'W':
			break
if 7 - bmin < wmin:
	print('B')
else:
	print('A')


def str_inp(n):
	return [input() for x in range(n)]

def get_str_col(arr, i):
	return ''.join([row[i] for row in arr])
from math import *
(s, w_mi, b_mi) = (str_inp(8), inf, inf)
for i in range(8):
	col = get_str_col(s, i)
	(w, b) = (col.find('W'), col.rfind('B'))
	(w_l, b_l) = (col.rfind('W'), col.find('B'))
	if w != -1 and b == -1:
		w_mi = min(w_mi, w - 0)
	elif w == -1 and b != -1:
		b_mi = min(b_mi, 7 - b)
	elif w == b == -1:
		continue
	else:
		if w < b_l:
			w_mi = min(w_mi, w - 0)
		if b > w_l:
			b_mi = min(b_mi, 7 - b)
print('AB'[w_mi > b_mi])


s = []
for i in range(8):
	s.append(input())
A = B = 9
for i in range(8):
	for j in range(8):
		if s[i][j] == 'W':
			pos = i - 1
			while pos >= 0:
				if s[pos][j] != '.':
					break
				pos -= 1
			if pos == -1:
				A = min(A, i)
		if s[i][j] == 'B':
			pos = i + 1
			while pos < 8:
				if s[pos][j] != '.':
					break
				pos += 1
			if pos == 8:
				B = min(B, 7 - i)
if B < A:
	print('B')
else:
	print('A')


index_B = list()
index_A = list()
for col in list(zip(*[list(input()) for i in range(8)])):
	step = 0
	for k in col:
		if k == 'W':
			index_A.append(step)
			break
		if k == 'B':
			break
		step += 1
	step = 0
	for k in col[::-1]:
		if k == 'B':
			index_B.append(step)
			break
		if k == 'W':
			break
		step += 1
print('A' if min(index_A or [8]) <= min(index_B or [8]) else 'B')


def main():
	l = []
	for i in range(8):
		l.append(input())
	d = []
	for i in range(8):
		c = ''
		for j in range(8):
			c += l[j][i]
		d.append(c)
	a = []
	b = []
	for i in range(8):
		B = -9
		A = 9
		if 'B' in d[i]:
			for j in range(7, -1, -1):
				if d[i][j] == 'W':
					break
				if d[i][j] == 'B':
					B = j
					break
		if 'W' in d[i]:
			for j in range(8):
				if d[i][j] == 'B':
					break
				if d[i][j] == 'W':
					A = j
					break
		if A != 9:
			a.append(A)
		if B != -9:
			b.append(7 - B)
	if min(a) <= min(b):
		return 'A'
	else:
		return 'B'
print(main())


import sys
top = [-1] * 8
top_let = [''] * 8
down = [-1] * 8
down_let = [''] * 8
for i in range(8):
	s = input().strip()
	j = 0
	while j < 8:
		if s[j] == 'W' or s[j] == 'B':
			if top[j] == -1:
				top[j] = i
				top_let[j] = s[j]
			down[j] = i
			down_let[j] = s[j]
		j += 1
min_w = 10
max_b = -1
for i in range(8):
	if top_let[i] == 'W' and min_w > top[i]:
		min_w = top[i]
	if down_let[i] == 'B' and max_b < down[i]:
		max_b = down[i]
if min_w > 8 - max_b - 1:
	print('B')
else:
	print('A')


import math
from collections import deque, defaultdict
from sys import stdin, stdout
listin = lambda : list(map(int, input().split()))
mapin = lambda : map(int, input().split())
board = []
for i in range(8):
	board.append(input())

def getmoves(i, j, move):
	if move == -1:
		for k in range(i - 1, -1, -1):
			if board[k][j] != '.':
				return 1000
		return i
	else:
		for k in range(i + 1, 8, 1):
			if board[k][j] != '.':
				return 1000
		return 8 - i - 1
(a, b) = (1000, 1000)
for i in range(8):
	for j in range(8):
		if board[i][j] == 'W':
			a = min(getmoves(i, j, -1), a)
		elif board[i][j] == 'B':
			b = min(getmoves(i, j, +1), b)
if a <= b:
	print('A')
else:
	print('B')


a = []
for i in range(8):
	a.append(list(input()))
b = 8
w = 8
for i in range(8):
	for j in range(8):
		if a[i][j] == 'B':
			k = 0
			while i + k != 7:
				k += 1
				if a[i + k][j] == 'W':
					k = 8
					break
			b = min(k, b)
		elif a[i][j] == 'W':
			k = 0
			while k != i:
				k += 1
				if a[i - k][j] == 'B':
					k = 8
					break
			w = min(k, w)
if b < w:
	print('B')
else:
	print('A')


R = range
m = ['' for i in R(8)]
for _ in R(8):
	v = input()
	for j in R(8):
		m[j] += v[j]
a = b = 9
for s in m:
	x = [s[::-1].find('B'), s[::-1].find('W'), s.find('W'), s.find('B')]
	for i in (0, 1, 2, 3):
		x[i] = [x[i], 9][x[i] < 0]
	if x[0] < x[1]:
		b = min(b, x[0])
	if x[2] < x[3]:
		a = min(a, x[2])
print('AB'[b < a])


def checkA(i, j):
	for k in range(i):
		if arr[k][j] != '.':
			return 1000
	return i

def checkB(i, j):
	for k in range(i + 1, 8):
		if arr[k][j] != '.':
			return 1000
	return 7 - i
arr = []
for i in range(8):
	a = input()
	arr.append(a)
minA = 1000
minB = 1000
for i in range(8):
	for j in range(8):
		if arr[i][j] == 'W':
			minA = min(minA, checkA(i, j))
		if arr[i][j] == 'B':
			minB = min(minB, checkB(i, j))
if minA <= minB:
	print('A')
else:
	print('B')


x = []
for i in range(8):
	x.append(input())
w = [[] for _ in range(8)]
b = [[] for _ in range(8)]
for i in range(8):
	for j in range(8):
		if x[i][j] == 'W':
			w[j].append(i)
		if x[i][j] == 'B':
			b[j].append(i)
wminn = 9
bminn = 9
for j in range(8):
	if len(w[j]) > 0 and len(b[j]) > 0:
		if min(w[j]) < min(b[j]):
			wminn = min(wminn, min(w[j]))
		if max(w[j]) < max(b[j]):
			bminn = min(bminn, 7 - max(b[j]))
		continue
	if len(w[j]) > 0 and len(b[j]) == 0:
		wminn = min(wminn, min(w[j]))
	if len(w[j]) == 0 and len(b[j]) > 0:
		bminn = min(bminn, 7 - max(b[j]))
if wminn <= bminn:
	print('A')
else:
	print('B')


def on_same_col(point, arr, flag):
	for p in arr:
		if flag and p[0] < point[0] and (p[1] == point[1]) or (not flag and p[0] > point[0] and (p[1] == point[1])):
			return True
	return False
whites = []
blacks = []
min_white = 10
min_black = 10
for row in range(8):
	row_str = input()
	for col in range(8):
		if row_str[col] == 'W':
			whites.append((row, col))
		if row_str[col] == 'B':
			blacks.append((row, col))
for white in whites:
	if not on_same_col((white[0], white[1]), blacks, True) and white[0] < min_white:
		min_white = white[0]
for black in blacks:
	if not on_same_col((black[0], black[1]), whites, False) and 7 - black[0] < min_black:
		min_black = 7 - black[0]
if min_white <= min_black:
	print('A')
else:
	print('B')


(b, w) = (float('inf'), float('inf'))
maps = []
maximumb = [-1 for i in range(8)]
maximumw = [-1 for i in range(8)]
minimumb = [10 for i in range(8)]
minimumw = [10 for i in range(8)]
for i in range(8):
	maps.append(input())
for i in range(len(maps)):
	for j in range(len(maps[i])):
		if maps[i][j] == 'B':
			maximumb[j] = max(maximumb[j], i)
			minimumb[j] = min(minimumb[j], i)
		elif maps[i][j] == 'W':
			maximumw[j] = max(maximumw[j], i)
			minimumw[j] = min(minimumw[j], i)
for i in range(8):
	if minimumb[i] > minimumw[i] and maximumw[i] < maximumb[i]:
		b = min(b, 7 - maximumb[i])
		w = min(w, minimumw[i])
	elif maximumb[i] > maximumw[i]:
		b = min(b, 7 - maximumb[i])
	elif minimumw[i] < minimumb[i]:
		w = min(w, minimumw[i])
if w <= b:
	print('A')
else:
	print('B')


a = [input() for i in range(8)]
(ra, rb) = (8, 8)
for j in range(8):
	for i in range(8):
		if a[i][j] == 'W':
			ra = min(ra, i)
		if a[i][j] != '.':
			break
for j in range(8):
	for i in range(7, -1, -1):
		if a[i][j] == 'B':
			rb = min(rb, 7 - i)
		if a[i][j] != '.':
			break
print('A' if ra <= rb else 'B')


a = [input() for i in range(8)]
(A, B) = (100, 100)
for i in range(8):
	for j in range(8):
		if a[i][j] == 'W':
			c = i
			while c > 0 and a[c - 1][j] == '.':
				c -= 1
			if c == 0:
				A = min(A, i)
		elif a[i][j] == 'B':
			c = i
			while c < 7 and a[c + 1][j] == '.':
				c += 1
			if c == 7:
				B = min(B, c - i)
if A > B:
	print('B')
else:
	print('A')


t = []
for i in range(8):
	ch = input()
	t.append(ch)
w = 10
b = 10
for j in range(8):
	pos = 8
	for i in range(8):
		if t[i][j] != '.':
			pos = i
			break
	if pos < 8 and t[pos][j] == 'W':
		w = min(w, pos)
	pos = 8
	for i in range(7, -1, -1):
		if t[i][j] != '.':
			pos = i
			break
	if pos < 8 and t[pos][j] == 'B':
		b = min(b, 7 - pos)
if w <= b:
	print('A')
else:
	print('B')


board = []
for _ in range(8):
	board.append(list(input()))
board = list(map(list, zip(*board)))
b = 8
w = 8

def min_index(l, c):
	for i in range(len(l)):
		if l[i] == c:
			return i
	return len(l) + 1
for j in range(8):
	ma = min_index(board[j], 'W')
	mb = min_index(board[j], 'B')
	if ma < mb:
		w = min(w, ma)
for j in range(8):
	ma = min_index(board[j][::-1], 'W')
	mb = min_index(board[j][::-1], 'B')
	if mb < ma:
		b = min(b, mb)
if w <= b:
	print('A')
else:
	print('B')


door = [input() for i in range(8)]
A = B = 10
for i in range(8):
	s = ''.join(map(str, [door[j][i] for j in range(8)]))
	a = b = 10
	for i in range(8):
		if s[i] == 'W':
			a = i
			break
		elif s[i] == 'B':
			break
	for i in range(7, -1, -1):
		if s[i] == 'B':
			b = 7 - i
			break
		elif s[i] == 'W':
			break
	A = min(a, A)
	B = min(b, B)
print('A' if A <= B else 'B')


def main():
	(ww, bb) = ([8], [8])
	for col in zip(*[input() for _ in range(8)]):
		_wb = ([8], [8], [])
		for (i, c) in enumerate(col):
			_wb['WB.'.find(c)].append(i)
		(_w, _b, _) = _wb
		(w, b) = (min(_w), min(_b))
		if w < b:
			ww.append(w)
		_w[0] = _b[0] = -1
		(w, b) = (max(_w), max(_b))
		if w < b:
			bb.append(7 - b)
	print('AB'[min(ww) > min(bb)])
main()


a = [0 for x in range(8)]
b = [0 for x in range(8)]
for row in range(1, 9):
	s = input()
	for col in range(8):
		if s[col] == 'W':
			if b[col] != 0:
				b[col] = -1
				if a[col] == 0:
					a[col] = -1
			elif a[col] == 0:
				a[col] = 9 - row
		if s[col] == 'B':
			b[col] = row
res = 'A' if max(a) >= max(b) else 'B'
print(res)


s = [None] * 8
for i in range(8):
	s[i] = input()
w = 99
b = 0
b = 8
for i in range(8):
	for j in range(8):
		if s[i][j] == 'W' and w == 99:
			f = 1
			for k in range(i - 1, -1, -1):
				if s[k][j] == 'B':
					f = 0
					break
			if f == 1:
				w = i
		elif s[i][j] == 'B':
			g = 1
			for l in range(i + 1, 8):
				if s[l][j] == 'W':
					g = 0
					break
			if g == 1:
				b = i
b = 7 - b
if w <= b:
	print('A')
else:
	print('B')


x = []
for i in range(8):
	x.append(input())
B_mov = 1000
for i in range(8):
	for j in range(8):
		if x[i][j] == 'B':
			count = 0
			for k in range(i + 1, 8):
				if x[k][j] == '.':
					count += 1
				else:
					break
			else:
				if count < B_mov:
					B_mov = count
			count = 0
A_mov = 1000
for i in range(8):
	for j in range(8):
		if x[i][j] == 'W':
			count = 0
			for k in range(i - 1, -1, -1):
				if x[k][j] == '.':
					count += 1
				else:
					break
			else:
				if count < A_mov:
					A_mov = count
			count = 0
if A_mov > B_mov:
	print('B')
else:
	print('A')


import sys
tbl = []
for i in range(8):
	tbl.append(input())
bestW = 10
bestB = 10
for i in range(8):
	for j in range(8):
		if tbl[i][j] == 'W':
			ok = True
			for k in range(i):
				if tbl[k][j] != '.':
					ok = False
			if ok:
				bestW = min(bestW, i)
		elif tbl[i][j] == 'B':
			ok = True
			for k in range(8 - i - 1):
				if tbl[i + k + 1][j] != '.':
					ok = False
			if ok:
				bestB = min(bestB, 8 - i - 1)
if bestW <= bestB:
	print('A')
else:
	print('B')


f = list(zip(*(list(input()) for _ in range(8))))
res = (1000000, 'X')
for line in f:
	w = line.count('W')
	b = line.count('B')
	if not w and (not b):
		continue
	if (w > 0) != (b > 0):
		c = 'W' if w else 'B'
		idx = line.index(c)
		if c == 'B':
			idx = line[::-1].index(c)
		idx = idx * 2
		if c == 'B':
			idx += 1
		cur = (idx, c)
		res = min(res, cur)
		continue
	for i in range(8):
		if line[i] == 'B':
			break
		if line[i] == 'W':
			cur = (i * 2, 'W')
			res = min(res, cur)
			break
	for i in range(8):
		if line[7 - i] == 'W':
			break
		if line[7 - i] == 'B':
			cur = (i * 2 + 1, 'B')
			res = min(res, cur)
			break
print('A' if res[1] == 'W' else 'B')


board = [['.' for x in range(8)] for x in range(8)]
for i in range(0, 8):
	strInput = input()
	for j in range(0, 8):
		board[i][j] = strInput[j]
minDistW = 0
minDistB = 0
isChangedB = 0
isChangedW = 0
for x in range(7, -1, -1):
	for y in range(0, 8):
		if board[x][y] == 'B':
			isWin = 1
			for z in range(7, x - 1, -1):
				if board[z][y] == 'W':
					isWin = 0
			if isWin == 1 and isChangedB == 0:
				minDistB = 7 - x
				isChangedB = 1
for x in range(0, 8):
	for y in range(0, 8):
		if board[x][y] == 'W':
			isWin = 1
			for z in range(0, x):
				if board[z][y] == 'B':
					isWin = 0
			if isWin == 1 and isChangedW == 0:
				minDistW = x
				isChangedW = 1
if minDistW <= minDistB:
	print('A')
else:
	print('B')