from math import ceil SIZE = 8 matrix = [] w_row = 0 w_col = 0 b_row = 0 b_col = 0 matrix_board = [] for board_row in range(SIZE, 0, -1): row_element = [f'{chr(97 + x)}{board_row}' for x in range(SIZE)] matrix_board.append(row_element) for row in range(SIZE): inner_list = input().split() for col in range(SIZE): if inner_list[col] == 'w': w_row = row w_col = col if inner_list[col] == 'b': b_row = row b_col = col matrix.append(inner_list) if not abs(b_col - w_col) == 1: if (SIZE - b_row) > w_row: print(f"Game over! White pawn is promoted to a queen at {matrix_board[SIZE - SIZE][w_col]}.") else: print(f"Game over! Black pawn is promoted to a queen at {matrix_board[SIZE - 1][b_col]}.") else: if abs(b_row - w_row) % 2 == 0: print(f"Game over! Black win, capture on {matrix_board[b_row + ceil(abs(b_row - w_row) / 2)][w_col]}.") else: print(f"Game over! White win, capture on {matrix_board[w_row - ceil(abs(b_row - w_row) / 2)][b_col]}.")