#pragma GCC optimize("O3")
#pragma GCC target("sse4")

#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>

#include <string>  // ヘッダファイルインクルード
#include <typeinfo>
using namespace std;  //  名前空間指定
using namespace std;
// using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;

typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<ld, ld> pd;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;

template <class T>

#define FOR(i, a, b) for (int i = a; i < (b); i++)
#define F0R(i, a) for (int i = 0; i < (a); i++)
#define FORd(i, a, b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i, a) for (int i = (a)-1; i >= 0; i--)

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define shandom_ruffle random_shuffle

const int MOD = 1000000007;
const ll INF = 1e18;
const int MX = 100001;  // check the limits, dummy

const ll infl = 1LL << 60;
template <class T>
bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool chmin(T &a, const T &b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}

template <class T>
void print(const vector<T> v) {
  cout << "[ ";
  F0R(i, v.size()) { cout << v[i] << ' '; }
  cout << "]" << '\n';
}

int mod(int i, int j) {
  return (i % j) < 0 ? (i % j) + 0 + (j < 0 ? -j : j) : (i % j + 0);
}

long long gcd(long long a, long long b) {
  if (b == 0) {
    return a;
  } else {
    return gcd(b, a % b);
  }
}

/*  lcm (a, b) : 2整数版
    入力：整数 a, b
    出力：aとbの最小公倍数
*/
long long lcm(long long a, long long b) {
  long long d = gcd(a, b);
  return a / d * b;
}

// --------------------------------------------------------
// This is tool
// --------------------------------------------------------
void Main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);

  int n;
  cin >> n;
  // pは与えられる配列
  vector<int> p(n);
  FOR(i, 0, n) cin >> p[i];

  vector<int> ans(n + 1000);
  vi done_swap(n - 1, 0);
  int count = 0;
  bool done_sort = true;
  int number = 1;
  int get_key = 0;

  FOR(i, 0, n) {
    if (p[i] == number) {
      for (int j = i - 1; j >= get_key; j--) {
        swap(p[j], p[j + 1]);
        ans[count] = j + 1;
        count++;
        done_swap[j]++;
        if (done_swap[j] != 1) {
          cout << -1 << endl;
          return;
        }
      }
      number = i + 1;
      get_key = i;
    }
  }
  FOR(i, 0, n - 1) {
    if (p[i] > p[i + 1]) {
      done_sort = false;
      break;
    }
  }
  if (done_sort and count == n - 1) {
    FOR(i, 0, n - 1) { cout << ans[i] << endl; }
  } else {
    cout << -1 << endl;
  }
}

int main() {
  std::cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);
  Main();
}
#include <bits/stdc++.h>
#define ll long long
#define pii pair<int,int>
#define vec vector
using namespace std;

const int MOD = 3;
const int INV[3] = {0, 1, 2};

int main() {
	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	#ifdef LOCAL
//		freopen("in1.txt", "r", stdin);
//		freopen("in1.txt", "w", stdout);
	#endif
	int n;
	cin >> n;
	string c;
	cin >> c;
	vec<int> a(n), b(n);
	for (int i=0, p=1, q=0, x; i<(n+1)/2; i++) {
		a[i] = a[n-i-1] = (q==0 ? p : 0);
		x = n-i-1;
		while (x%MOD==0) {
			q++;
			x /= MOD;
		}
		p = (p * x) % MOD;
		
		x = i+1;
		while (x%MOD==0) {
			q--;
			x /= MOD;
		}
		p = (p * INV[x%MOD]) % MOD;
	}
//	cout << "a "; for (int x : a) cout << x << ' '; cout << '\n';
	int sum = 0;
	for (int i=0; i<n; i++) {
		if (c[i] == 'W') sum = (sum + a[i]*1) % MOD;
		if (c[i] == 'R') sum = (sum + a[i]*2) % MOD;
	}
	if (n%2 == 0) sum = -sum;
	sum = (sum%MOD + MOD) % MOD;
	if (sum == 0) cout << 'B';
	if (sum == 1) cout << 'W';
	if (sum == 2) cout << 'R';
	cout << '\n';
}