#include<bits/stdc++.h>
using namespace std;
#define REP(i,a,b) for(ll i = a; i < b; ++i)
#define REPN(i,a,b) for(ll i = a; i <= b; ++i)
#define REPV(i,a,b) for(ll i = a; i >= b; --i)
#define db1(x) cout<<#x<<"="<<x<<'\n'
#define db2(x,y) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<'\n'
#define db3(x,y,z) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<","<<#z<<"="<<z<<'\n'
#define with_tests int t; cin>>t; while(t--){ solve(); }
#define without_tests solve();
#define all(x) (x).begin(), (x).end()
#define ll long long
#define INF LLONG_MAX
#define ff first
#define ss second
#define max(a, b) ({ __typeof__ (a) _a = (a); __typeof__ (b) _b = (b); _a > _b ? _a : _b; })
#define min(a, b) ({ __typeof__ (a) _a = (a); __typeof__ (b) _b = (b); _a < _b ? _a : _b; })
const int M=1e9+7;

template<typename T>
void print(std::vector<T> & A)
{
	for(auto&e : A)
	{
		cout<<e<<" ";
	}
	cout<<"\n";
}

void solve()
{
	ll n, m;
	cin>>n>>m;
	vector<vector<char>> A(n, vector<char>(m));
	REP(i,0,n)
	{
		REP(j,0,m)
		{
			cin>>A[i][j];
		}
	}
	REP(k,0,2)
	{
		bool found = true;
		REP(i,0,n)
		{
			REP(j,0,m)
			{
				char c = ((i + j + k) & 1) ? 'R' : 'W';
				if(A[i][j] == c)
				{
					found = false;
				}
			}
		}
		if(found)
		{
			cout<<"YES\n";
			REP(i,0,n)
			{
				REP(j,0,m)
				{
					char c = ((i + j + k + 1) & 1) ? 'R' : 'W';
					cout<<c; 
				}
				cout<<"\n";
			}
			return;
		}
	}
	cout<<"NO\n";
}

int main()
{
	/*
	#ifndef ONLINE_JUDGE
	    freopen("input.txt","r",stdin);
	    freopen("output.txt","w",stdout);
	#*/
	ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    with_tests;
    //without_tests;
    return 0;
}