#include <iostream>
#include <string>
#include <vector>

bool contains(const std::string& s, char c) {
	return s.find(c) != std::string::npos;
}

int main() {
	const std::string allowed_in_cyan = "BCG";
	const std::string allowed_in_magenta = "BMR";
	const std::string allowed_in_yellow = "GRY";
	const std::string color_mixes[4] = {
		"WCMY",
		"CCBG",
		"MBMR",
		"YGRY",
	};
	int n;
	std::cin >> n;
	std::vector<std::string> grid(n);
	std::vector<int> answers[2];
	for (int i = 0; i < n; i++) {
		std::cin >> grid[i];
	}
	for (int k = 0; k < 2; k++) {
		answers[k].resize(n);
		for (int i = 0; i < n; i++) {
			bool can_be_cyan = true;
			bool can_be_magenta = true;
			bool can_be_yellow = true;
			for (int j = 0; j < 2; j++) {
				char color = k == 0 ? grid[i][j] : grid[j][i];
				can_be_cyan = can_be_cyan && contains(allowed_in_cyan, color);
				can_be_magenta = can_be_magenta && contains(allowed_in_magenta, color);
				can_be_yellow = can_be_yellow && contains(allowed_in_yellow, color);
			}
			if (can_be_cyan)
				answers[k][i] = 1;
			else if (can_be_magenta)
				answers[k][i] = 2;
			else if (can_be_yellow)
				answers[k][i] = 3;
		}
	}
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++) {
			if (grid[i][j] != color_mixes[answers[0][i]][answers[1][j]]) {
				std::cout << "IMPOSSIBLE";
				return 0;
			}
		}
	}
	for (int k = 0; k < 2; k++) {
		for (int i = 0; i < n; i++) {
			std::cout << color_mixes[0][answers[k][i]];
		}
		std::cout << '\n';
	}
	return 0;
}
