#pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") #include using namespace std; #define rep(i,n) for(ll i=0;i=l;i--) using ll = long long; using ld = long double; const ll mod=998244353; #define vout(v) for(auto i :v) cout< #define pb push_back #define vc vector #define vb vector #define uniq(x) sort((x).begin(),(x).end());(x).erase(unique((x).begin(),(x).end()),(x).end()) #define eb emplace_back void no(void) { cout<<"No"< dx={-1,0,1,0,1,1,-1,-1}; vector dy={0,-1,0,1,-1,1,-1,1}; bool isin(ll i,ll j,ll h,ll w) { if(i<0 || i>=h || j<0 || j>=w) return false; return true; } template bool chmin(T& a, T b){if(a > b){a = b; return true;} return false;} template bool chmax(T& a, T b){if(a < b){a = b; return true;} return false;} templateT vecmax(const vector&v){return *max_element(all(v));} templateT vecmin(const vector&v){return *min_element(all(v));} ll safemod(ll num,ll rule) { return (num%rule+rule)%rule; } struct res { vl ws; vl bs; ll w; ll b; }; //ファイル読み込みは第二フォルダから ex:include "mathtype/hoge.hpp" int main() { ll n; cin>>n; vl a(n); rep(i,n) cin>>a[i]; function rec=[&](ll size,ll w,ll b,vl ws,vl bs)->res { if(size==n) return {ws,bs,w,b}; ll best=-1; res bestset={{},{},-1,-1}; if((a[size]&b)==0) { ll nw=w|a[size]; vl nws=ws; nws.pb(size); auto [rws,rbs,rw,rb]=rec(size+1,nw,b,nws,bs); ll prod=rw*rb; if(prod>best) { best=prod; bestset={rws,rbs,rw,rb}; } } if((a[size]&w)==0) { ll nb=b|a[size]; vl nbs=bs; nbs.pb(size); auto [rws,rbs,rw,rb]=rec(size+1,w,nb,ws,nbs); ll prod=rw*rb; if(prod>best) { best=prod; bestset={rws,rbs,rw,rb}; } } return bestset; }; auto [ws,bs,aw,ab]=rec(0,0,0,vector(0),vector(0)); cout< setW(all(ws)); rep(i,n) { if(setW.count(i)) s+="W"; else s+="B"; } cout<