allowed_in_cyan = "BCG"
allowed_in_magenta = "BMR"
allowed_in_yellow = "GRY"
color_mixes = [
    "WCMY",
    "CCBG",
    "MBMR",
    "YGRY"
]
n = int(input())
grid = [input() for _ in range(n)]
answers = [n * [0], n * [0]]
for k in range(2):
    for i in range(n):
        can_be_cyan = True
        can_be_magenta = True
        can_be_yellow = True
        for j in range(2):
            color = grid[i][j] if k == 0 else grid[j][i]
            can_be_cyan = can_be_cyan and color in allowed_in_cyan
            can_be_magenta = can_be_magenta and color in allowed_in_magenta
            can_be_yellow = can_be_yellow and color in allowed_in_yellow
        if can_be_cyan:
            answers[k][i] = 1
        elif can_be_magenta:
            answers[k][i] = 2
        elif can_be_yellow:
            answers[k][i] = 3
correct = True
for i in range(n):
    for j in range(n):
        if grid[i][j] != color_mixes[answers[0][i]][answers[1][j]]:
            correct = False
if correct:
    for k in range(2):
        result = ""
        for i in range(n):
            result += color_mixes[0][answers[k][i]]
        print(result)
else:
    print("IMPOSSIBLE")
