#include using namespace std; int main() { int t, n, hamming_sum, max_val; string X, Y, Z, tmp; cin >> t; assert(t >= 1 && t <= 3); while ( t-- ) { cin >> X >> Y; n = (int)X.size(); assert(n == (int)Y.size()); assert(n >= 1 && n <= 16); for ( int i = 0; i < n; i++ ) { assert(X[i] == 'W' || X[i] == 'B'); assert(Y[i] == 'W' || Y[i] == 'B'); } max_val = -1; //bit masking considers all the possibilities. for ( int i = 0; i < (1 << n); i++ ) { tmp = "", hamming_sum = 0; for ( int j = 0; j < n; j++ ) { if ( i & (1<< j) ) tmp.push_back('W'); else tmp.push_back('B'); hamming_sum += (tmp[j] != X[j]) + (tmp[j] != Y[j]); } if ( hamming_sum > max_val ) max_val = hamming_sum, Z = tmp; else if ( hamming_sum == max_val ) Z = min(Z, tmp); } cout << Z << endl; } return 0; }