n = int(input()) board = [input() for _ in range(n)] all_s = [i for i in range(n) if 'F' not in board[i]] all_f = [i for i in range(n) if 'S' not in board[i]] chosen, special, other = max((all_s, 'S', 'F'), (all_f, 'F', 'S'), key=lambda x: len(x[0])) chosen.sort(key=lambda i: -board[i].count(special)) NEED = n // 4 + 1 assert len(chosen) >= NEED chosen = chosen[:NEED] for i, row in enumerate(board): for j, cell in enumerate(row): if i == j: print('.', end='') elif i in chosen or j in chosen: assert cell in (special, '?') print(special, end='') elif cell == '?': print(other, end='') else: print(cell, end='') print()