/**
 ** Software is like sex
 -> It is better when it is free
**/

#include <bits/stdc++.h>

using namespace std;

char arr[100][100];
char arr1[100][100], arr2[100][100];

void solve() {
	int n, m;
	cin >> n >> m;
	for(int i = 0; i < n; i++)
		for(int j = 0; j < m; j++) {
			cin >> arr[i][j];
			if((i +j) % 2 == 0) {
				arr1[i][j] = 'R';
				arr2[i][j] = 'W';
			} else {
				arr1[i][j] = 'W';
				arr2[i][j] = 'R';
			}
		}

	bool check = true;
	for(int i = 0; i < n; i++)
		for(int j = 0; j < m; j++) {
			if(arr[i][j] == '.') continue;
			check &= (arr[i][j] == arr1[i][j]);
		}
	
	if(check == true) {
		cout << "YES" << endl;
		for(int i = 0; i < n; i++) {
			for(int j = 0; j < m; j++)
				cout << arr1[i][j];

			cout << endl;
		}

		return;
	}

	check = true;
	for(int i = 0; i < n; i++)
		for(int j = 0; j < m; j++) {
			if(arr[i][j] == '.') continue;
			check &= (arr[i][j] == arr2[i][j]);
		}
	
	if(check == true) {
		cout << "YES" << endl;
		for(int i = 0; i < n; i++) {
			for(int j = 0; j < m; j++)
				cout << arr2[i][j];

			cout << endl;
		}

		return;
	}

	cout << "NO" << endl;
}

int main() {
	cin.tie(0); cout.tie(0);
	ios_base::sync_with_stdio(0);

	int t;
	cin >> t;
	while(t--) solve();

	return 0;
}

