#include<bits/stdc++.h>
using namespace std;

#define int             long long
#define w(x)            int x; cin>>x; while(x--)
#define endl            ("\n")
#define f(i, a, n)      for(int i=a; i<n; i++)
#define cc(r)           cout<<r<<" "
#define ce(r)           cout<<r<<endl



void inout()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

}
int nCrModpDP(int n, int r, int p)
{
    int C[r + 1];
    memset(C, 0, sizeof(C));

    C[0] = 1;
    for (int i = 1; i <= n; i++)
    {
        for (int j = min(i, r); j > 0; j--)
            C[j] = (C[j] + C[j - 1]) % p;
    }
    return C[r];
}

int nCrModpLucas(int n, int r, int p)
{
    if (r == 0)
        return 1;
    int ni = n % p, ri = r % p;
    return (nCrModpLucas(n / p, r / p, p) * nCrModpDP(ni, ri, p)) % p;
}
int32_t main()
{
    inout();
    int n;
    cin >> n;
    int r[n], a[n], ans = 0;
    f(i, 0, n) {
        r[i] = nCrModpLucas(n - 1, i, 3);
    }
    char k;
    f(i, 0, n) {
        cin >> k;
        if (k == 'B')
            a[i] = 0;
        else if (k == 'W')
            a[i] = 1;
        else
            a[i] = 2;
    }
    f(i, 0, n) {
        ans = (ans + (a[i] * r[i]) % 3) % 3;
    }
    if ((n & 1) == 0) {
        ans = (-ans + 3) % 3;
    }
    if (ans == 0)
        ce('B');
    else if (ans == 1)
        ce('W');
    else
        ce('R');

}



#include <bits/stdc++.h>

using namespace std;
using namespace chrono;
using ll = long long;
constexpr double TIME_LIMIT = 2.95;

system_clock::time_point start;
double elapsed = 0;
int loops = 1;
int steps = 10;
int N;
int M;
vector<string> S;
vector<string> output;
int base_num = 9;
char bases[] = {'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', '.'};

static uint32_t randXor() {
    static uint32_t x = 123456789;
    static uint32_t y = 362436069;
    static uint32_t z = 521288629;
    static uint32_t w = 88675123;
    uint32_t t;

    t = x ^ (x << 11);
    x = y;
    y = z;
    z = w;
    return w = (w ^ (w >> 19)) ^ (t ^ (t >> 8));
}

static double rand01() { return (randXor() + 0.5) * (1.0 / UINT_MAX); }

int get_score(vector<string> &output) {
    int score;
    int c = 0, d = 0;

    bool match = false;
    for (int i = 0; i < M; i++) {
        match = false;
        // horizontal
        for (int h = 0; h < N; h++) {
            for (int w = 0; w < N; w++) {
                bool check = true;
                for (int j = 0; j < S[i].length(); j++) {
                    if (S[i][j] != output[h][(w + j) % N]) {
                        check = false;
                        break;
                    }
                }
                if (check) {
                    match = true;
                    goto matched;
                }
            }
        }
        // vertical
        for (int h = 0; h < N; h++) {
            for (int w = 0; w < N; w++) {
                bool check = true;
                for (int j = 0; j < S[i].length(); j++) {
                    if (S[i][j] != output[(h + j) % N][w]) {
                        check = false;
                        break;
                    }
                }
                if (check) {
                    match = true;
                    goto matched;
                }
            }
        }
    matched:
        if (match) c++;
    }

    for (int h = 0; h < N; h++) {
        for (int w = 0; w < N; w++) {
            if (output[h][w] == '.') d++;
        }
    }

    if (c == M) {
        score =
            round(1e8 * 2 * (double)pow(N, 2) / (double)(2 * pow(N, 2) - d));
    } else {
        score = round(1e8 * (double)c / (double)M);
    }
    return score;
}

void init() {
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < N; j++) {
            output[i][j] = bases[randXor() % base_num];
        }
    }
}

vector<string> mutate(vector<string> output) {
    int H = randXor() % N;
    int W = randXor() % N;

    string T = S[randXor() % M];
    int st = randXor() % N;
    if (randXor() % 2 == 1) {
        for (int i = 0; i < T.length(); i++) {
            output[H][(st + i) % N] = bases[randXor() % base_num];
        }
    } else {
        for (int i = 0; i < T.length(); i++) {
            output[(st + i) % N][W] = bases[randXor() % base_num];
        }
    }

    return output;
}

int main() {
    start = system_clock::now();
    // srand(time(NULL));

    cin >> N >> M;
    S.resize(M);
    for (auto &s : S) cin >> s;
    output.resize(N);
    for (auto &o : output) o.resize(N);

    init();
    int score = get_score(output);
    while (elapsed < TIME_LIMIT * 1e6) {
        if (loops % steps == 0) {
            elapsed = duration_cast<microseconds>(system_clock::now() - start)
                          .count();
        }
        vector<string> output_new = mutate(output);
        int score_new = get_score(output_new);
        if (score_new > score) {
            output = output_new;
            score = score_new;
        }
        loops++;
    }

    for (auto o : output) cout << o << endl;

    // int score = get_score();
    // cout << score << endl;
    // cout << loops << endl;

    return 0;
}
