#include using namespace std; using uint = unsigned int; const uint MAX_A = bit_ceil((uint)4000); int main() { cin.tie(nullptr); ios_base::sync_with_stdio(false); int n; cin >> n; vector a(n); for (uint &x : a) cin >> x; vector col(n, false); uint ans = 0; for (uint i = 1; i < MAX_A; i++) { uint w = 0, b = 0; vector tmp(n, false); for (int j = 0; j < n; j++) { if ((i & a[j]) == 0) { b |= a[j]; tmp[j] = true; } else if ((i & a[j]) == a[j]) { w |= a[j]; } else { w = 0; b = 0; break; } } if (w * b > ans) { ans = w * b; col = tmp; } } cout << ans << "\n"; for (int i = 0; i < n; i++) { cout << (col[i] ? "W" : "B"); } cout << endl; return 0; }