Today we will be playing a red and white colouring game (no, this is not the Russian Civil War; these are just the colours of the Canadian flag).You are given an $$$n \times m$$$ grid of "R", "W", and "." characters. "R" is red, "W" is white and "." is blank. The neighbours of a cell are those that share an edge with it (those that only share a corner do not count).Your job is to colour the blank cells red or white so that every red cell only has white neighbours (and no red ones) and every white cell only has red neighbours (and no white ones). You are not allowed to recolour already coloured cells.

The first line contains $$$t$$$ ($$$1 \le t \le 100$$$), the number of test cases. In each test case, the first line will contain $$$n$$$ ($$$1 \le n \le 50$$$) and $$$m$$$ ($$$1 \le m \le 50$$$), the height and width of the grid respectively. The next $$$n$$$ lines will contain the grid. Each character of the grid is either 'R', 'W', or '.'.

For each test case, output "YES" if there is a valid grid or "NO" if there is not. If there is, output the grid on the next $$$n$$$ lines. If there are multiple answers, print any. In the output, the "YES"s and "NO"s are case-insensitive, meaning that outputs such as "yEs" and "nO" are valid. However, the grid is case-sensitive.

YES
WRWRWR
RWRWRW
WRWRWR
RWRWRW
NO
YES
R
W
R
W
R

NoteThe answer for the first example case is given in the example output, and it can be proven that no grid exists that satisfies the requirements of the second example case. In the third example all cells are initially coloured, and the colouring is valid.

'use strict';

process.stdin.resume();
process.stdin.setEncoding('utf-8');

let inputString = '';
let currentLine = 0;

process.stdin.on('data', inputStdin => {
   inputString += inputStdin;
});

process.stdin.on('end', _ => {
  inputString = inputString.trim().split('\n').map(string => {
    return string.trim();
  });

  main();
});

function readline() {
  return inputString[currentLine++];
}

// End of Codeforces interface

function fillLine(c1, c2, index, length) {
  let line = '';
  for (let i = 0; i < length; i++) {
    const first = index % 2 == i % 2;
    line += (first ? c1 : c2);
  }
  return line;
}

function fillGrid(x, y, c1, c2) {
  const grid = [];
  for (let i = 0; i < x; i++) {
    grid.push(fillLine(c1, c2, i, y));
  }
  return grid;
}

function isOkGrid(initialGrid, finalGrid) {
  try {
    initialGrid.forEach((x, i) => {
      for (let y = 0; y < x.length; y++) {
        if (x.charAt(y) != '.') {
          if (x.charAt(y) != finalGrid[i].charAt(y)) throw new Error();
        }
      }
    });
    return true;
  } catch (e) {
    return false;
  }
}

function main() {
  let testCaseCount = readline();

  for (let i = 0; i < testCaseCount; i++) {
    let [x, y] = readline().split(" ").map(n => parseInt(n));
    let initialGrid = [];
    let finalGrid;
    let isOkTestCase;

    for (let j = 0; j < x; j++) {
      initialGrid.push(readline());
    }

    finalGrid = fillGrid(x, y, 'R', 'W');
    isOkTestCase = isOkGrid(initialGrid, finalGrid);

    if (!isOkTestCase) {
      finalGrid = fillGrid(x, y, 'W', 'R');
      isOkTestCase = isOkGrid(initialGrid, finalGrid);
    }

    if (isOkTestCase) {
      console.log('YES');
      for (let line of finalGrid) {
        console.log(line);
      }
    } else {
      console.log('NO');
    }
  }
}

//Don't have to see. start------------------------------------------
var read = require('readline').createInterface({
	input: process.stdin, output: process.stdout
});
var obj; var inLine = []; var outputList = [];var retcode = new Set();
read.on('line', function(input){
	var tmp = input.split(' ');
	for(var i = 0; i < tmp.length; i++){
		inLine.push(tmp[i]);
		if(i == tmp.length - 1){
			retcode.add(inLine.length);
		}
	}
});
read.on('close', function(){
	obj = init(inLine);
	console.error('\n↑入力 ↓出力');
	Main();
	console.log(myconv(outputList, 9));
});
function makeClone(obj){return (obj instanceof Set) ? new Set(Array.from(obj)) : JSON.parse(JSON.stringify(obj));}
function nextArray(size, code){
	var ret = new Array(size);
	for(var i = 0; i < size; i++){
		if(code == 'int'){
			ret[i] = nextInt();
		}else if(code == 'long'){
			ret[i] = BigInt(next());
		}else{
			ret[i] = next();
		}
	}
	return ret;
}
function nextIntArray(size){return nextArray(size, 'int');} function nextStrArray(size){return nextArray(size, 'str');} function nextLongArray(size){return nextArray(size, 'long');}
function nextCharArray(){return myconv(next(),6);}
function next(){return obj.next();} function hasNext(){return obj.hasNext();} function nextInt(){return myconv(next(),1);} function nextLong(){return BigInt(next());}
function getCountMap(list){
	var map = {};
	for(var i = 0; i < list.length; i++){
		if(map[list[i]] == null){
			map[list[i]] = 0;
		}
		map[list[i]]++;
	}
	return map;
}
function init(input){
	return {
		list : input, index : 0, max : input.length,
		hasNext : function(){return (this.index < this.max);},
		next : function(){if(this.hasNext()){return this.list[this.index++];}else{throw 'ArrayIndexOutOfBoundsException ‚There is no more input';}},
		isReturn : function(){return retcode.has(this.index);}
	};
}
function myout(s){outputList.push(s);}
function myerr(s){console.error('debug:' + require('util').inspect(s,false,null));}
function isReturn(){return obj.isReturn();}
//param "no" is
//unknown or outlier : return i. 1: parseInt.
//2: split space. 4: split space and parseInt.
//6: split 1 character. 7: split 1 character and parseInt.
//8: join space. 9: join nextline. 0: join no character.
function myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(' ');case 4:return i.split(' ').map(Number);case 6:return i.split('');case 7:return i.split('').map(Number);case 8:return i.join(' ');case 9:return i.join('\n');case 0:return i.join('');default:return i;}}catch(e){return i;}}

//Don't have to see. end------------------------------------------
function Main(){
	var t = nextInt();
	var dy = [-1,0,1,0];
	var dx = [0,-1,0,1];
	while(hasNext()){
		var H = nextInt();
		var W = nextInt();
		var s = new Array(H);
		for(var i = 0; i < H; i++){
			s[i] = nextCharArray();
		}
		var queue = [];
		for(var i = 0; i < H; i++){
			for(var j = 0; j < W; j++){
				if(s[i][j] != "."){
					queue.push([i,j]);
				}
			}
		}
		if(queue.length == 0){
			queue.push([0,0]);
			s[0][0] = "R";
		}
		while(queue.length > 0){
			var tmp = queue.shift();
			var y = tmp[0];
			var x = tmp[1];
			for(var j = 0; j < dy.length; j++){
				var nextY = y + dy[j];
				var nextX = x + dx[j];
				if(nextY >= 0 && nextY < H && nextX >= 0 && nextX < W){
					if(s[nextY][nextX] == "."){
						if(s[y][x] == "R"){
							s[nextY][nextX] = "W";
						}else{
							s[nextY][nextX] = "R";
						}
						queue.push([nextY, nextX]);
					}
				}
			}
		}
		var isOK = true;
		for(var i = 0; i < H - 1; i++){
			for(var j = 0; j < W; j++){
				if(s[i][j] == s[i + 1][j]){
					isOK = false;
				}
			}
		}
		for(var i = 0; i < H; i++){
			for(var j = 0; j < W - 1; j++){
				if(s[i][j] == s[i][j + 1]){
					isOK = false;
				}
			}
		}
		myout((isOK) ? "Yes" : "No");
		if(isOK){
			for(var i = 0; i < H; i++){
				myout(myconv(s[i], 0));
			}
		}
	}
}

let i = "";
process.stdin.on("data", c => (i += c));
process.stdin.on("end", () => {
	const { EOL } = require("os");
	const lines = i.split(EOL);
	solve(lines);
});

function solve(lines) {
	const t = lines[0];
	let index = 1;
	for (let i = 0; i < t; i++) {
		const ij = lines[index++];
		const [n, m] = ij.split(" ").map(c => +c);
		let map = { R: [], W: [], ".": [] };
		for (let j = 0; j < n; j++) {
			const line = lines[index++];
			line.split("").forEach((c, k) => {
				map[c].push([(k + j) % 2, j, k]);
			});
		}
		let rVal = -1;
		map["R"].forEach(element => {
			if (rVal === -1) {
				rVal = element[0];
			} else if (element[0] !== rVal) {
				rVal = -2;
			}
		});
		let wVal = -1;
		map["W"].forEach(element => {
			if (wVal === -1) {
				wVal = element[0];
			} else if (element[0] !== wVal) {
				wVal = -2;
			}
		});
		if (rVal === -2 || wVal === -2 || (rVal === wVal && rVal !== -1) ) {
			console.log("NO");
		} else {
			console.log("YES");
			if (rVal === -1) {
                if(wVal === 1)
				    rVal = 0;
                else
                    rVal = 1;
			}
			for (let l = 0; l < n; l++) {
				let res = "";
				for (let c = 0; c < m; c++) {
					if (rVal === (c + l) % 2) {
						res += "R";
					} else {
						res += "W";
					}
				}
				console.log(res);
			}
		}
	}
}

/**
 * Accomplished using the EduTools plugin by JetBrains https://plugins.jetbrains.com/plugin/10081-edutools
 *
 * To modify the template, go to Preferences -> Editor -> File and Code Templates -> Other
 */

// Write your solution here
const {EOL} = require("os");

function alternate_color(current_color) {
    return current_color === 'R' ? 'W' : 'R';
}

function is_valid(flag, start_color) {
    for (const row of flag) {
        let expected_color = start_color;
        for (const actual_color of row) {
            if (actual_color !== '.' && actual_color !== expected_color) {
                return false;
            }
            expected_color = alternate_color(expected_color);
        }
        start_color = alternate_color(start_color);
    }
    return true;
}

function print_solution(start_color, height, width) {
    for (let row_no = 0; row_no < height; row_no += 1) {
        let row_str = '';
        let color = start_color;
        for (let col_no = 0; col_no < width; col_no += 1) {
            row_str += color;
            color = alternate_color(color);
        }
        console.log(row_str);
        start_color = alternate_color(start_color);
    }

}

function solution({height, width, flag}) {
    for (const start_color of ['R', 'W']) {
        if (is_valid(flag, start_color)) {
            console.log('YES');
            print_solution(start_color, height, width);
            return;
        }
    }
    console.log('NO');
}

function parse(input) {
    const [height, width] = input.shift().split(' ').map(Number);
    return {
        height, width,
        flag: input.splice(0, height).map(row => row.trim())
    };
}

let lines = '';

process.stdin.on('data', data => lines += data);

process.stdin.on('end', () => {
    const input = lines.split(EOL);
    const number_of_test_cases = Number(input.shift());
    for (let _ = 0; _ < number_of_test_cases; _ += 1) {
        solution(parse(input));
    }
    process.exit();
});

const {EOL} = require("os");

function alternate_color(current_color) {
    return current_color === 'R' ? 'W' : 'R';
}

function is_valid(flag, start_color) {
    for (const row of flag) {
        let expected_color = start_color;
        for (const actual_color of row) {
            if (actual_color !== '.' && actual_color !== expected_color) {
                return false;
            }
            expected_color = alternate_color(expected_color);
        }
        start_color = alternate_color(start_color);
    }
    return true;
}

function print_solution(start_color, height, width) {
    for (let row_no = 0; row_no < height; row_no += 1) {
        let row_str = '';
        let color = start_color;
        for (let col_no = 0; col_no < width; col_no += 1) {
            row_str += color;
            color = alternate_color(color);
        }
        console.log(row_str);
        start_color = alternate_color(start_color);
    }

}

function solution({height, width, flag}) {
    for (const start_color of ['R', 'W']) {
        if (is_valid(flag, start_color)) {
            console.log('YES');
            print_solution(start_color, height, width);
            return;
        }
    }
    console.log('NO');
}

function parse(input) {
    const [height, width] = input.shift().split(' ').map(Number);
    return {
        height, width,
        flag: input.splice(0, height).map(row => row.trim())
    };
}

let lines = '';

process.stdin.on('data', data => lines += data);

process.stdin.on('end', () => {
    const input = lines.split(EOL);
    const number_of_test_cases = Number(input.shift());
    for (let _ = 0; _ < number_of_test_cases; _ += 1) {
        solution(parse(input));
    }
});

process.stdin.resume();
process.stdin.setEncoding('utf-8');

let inputString = '';
let currentLine = 0;

process.stdin.on('data', inputStdin => {
    inputString += inputStdin;
});

process.stdin.on('end', _ => {
    inputString = inputString.trim().split('\n').map(str => str.trim());

    main();
});

function readLine() {
    return inputString[currentLine++];
}
var gcd = function(a, b) {
    if (!b) {
      return a;
    }

    return gcd(b, a % b);
}

function main()
{
    //const name=readLine();
    //console.log(name);

    let test=readLine();
    while(test--)
    {
        nn=readLine();
        nn=nn.split(" ");
        n=parseInt(nn[0]);
        m=parseInt(nn[1]);
        grid=[];
        pos_x=-1,pos_y=-1;
        for(i=0;i<n;i++)
        {
            nn=readLine();
            nn.split(" ");
            temp=[];
            for(j=0;j<m;j++)
            {
                temp.push(nn[j]);
                if(pos_x===-1 && pos_y===-1 && nn[j]!='.')
                {
                    pos_x=i;
                    pos_y=j;
                }
            }
            grid.push(temp);
        }
        if(pos_x===-1 && pos_y===-1)
        {
            //cout<<"YES"<<endl;
            console.log("YES");
            for(i=0;i<n;i++)
            {

                previous='';
                if(i===0)
                    previous='s';
                else
                    previous=grid[i-1][0];
                str=""
                for(j=0;j<m;j++)
                {
                    give='';
                    if(i===0 && j===0)
                        give='W';
                    if(previous==='R')
                        give='W';
                    else if(previous==='W')
                        give='R';
                    grid[i][j]=give;
                    previous=give;
                    str+=grid[i][j]
                    //cout<<grid[i][j];

                }
                console.log(str);
               // cout<<endl;
            }
            continue;
        }

        chk=true;
        ///line left
        ch=grid[pos_x][pos_y];
        //cout<<ch<<endl;
        for(j=pos_y-1;j>=0;j--)
        {
            if(ch=='R')
            {
                cur='W';
                temp=grid[pos_x][j];
                if(temp===ch)
                {
                    chk=false;
                    break;
                }
                else
                {
                    grid[pos_x][j]=cur;
                    ch=cur;
                }
            }
            else
            {
                cur='R';
                temp=grid[pos_x][j];
                if(temp===ch)
                {
                    chk=false;
                    break;
                }
                else
                {
                    grid[pos_x][j]=cur;
                    ch=cur;
                }
            }
        }

        ///line right
        ch=grid[pos_x][pos_y];
        for(j=pos_y+1;j<m ;j++)
        {
            if(ch==='R')
            {
                cur='W';
                temp=grid[pos_x][j];
                if(temp===ch)
                {
                    chk=false;
                    break;
                }
                else
                {
                    grid[pos_x][j]=cur;
                    ch=cur;
                }
            }
            else
            {
                cur='R';
                temp=grid[pos_x][j];
                if(temp===ch)
                {
                    chk=false;
                    break;
                }
                else
                {
                    grid[pos_x][j]=cur;
                    ch=cur;
                }
            }
        }

        ///up
        for(i=pos_x-1;i>=0;i--)
        {
            now=grid[i+1][0];
            for(j=0;j<m;j++)
            {
                give='';
                if(now==='R')
                    give='W';
                else
                    give='R';
                if(grid[i][j]===now)
                {
                    chk=false;
                    break;
                }
                else
                {
                    grid[i][j]=give;
                    now=give;
                }

            }
            if(chk==false)
                break;
        }

        ///down

        for(i=pos_x+1;i<n;i++)
        {
            now=grid[i-1][0];
            for(j=0;j<m;j++)
            {
                give='';
                if(now==='R')
                    give='W';
                else
                    give='R';
                if(grid[i][j]===now)
                {
                    chk=false;
                    break;
                }
                else
                {
                    grid[i][j]=give;
                    now=give;
                }

            }
            if(chk===false)
                break;
        }

        if(chk===false)
        {
            console.log("NO")
            //cout<<"NO"<<endl;
            continue;
        }
        console.log("YES");
        //cout<<"YES"<<endl;

        for(i=0;i<n;i++)
        {
            out="";
            for(j=0;j<m;j++)
                out+=grid[i][j];
            console.log(out);
        }

    }
}

///////////////////////////////// pre-define ////////////////////////////////////////////////////////////////////////////////
const pr = console.log;
const mi = Math.min;
const mx = Math.max;
const mxll = (...args) => args.reduce((m, e) => e > m ? e : m);
const mill = (...args) => args.reduce((m, e) => e < m ? e : m);
const sqll = (v) => { if (v < 0n) throw 'negative input'; if (v < 2n) return v; const dfs = (n, x0) => { let x1 = ((n / x0) + x0) >> 1n; if (x0 === x1 || x0 === (x1 - 1n)) return x0; return dfs(n, x1); }; return dfs(v, 1n); }; // has >> 0
const abs = Math.abs;
const fl = Math.floor;
const ce = Math.ceil;
const sq = Math.sqrt;
const lge = Math.log;
const lg10 = Math.log10;
const ll = BigInt;
const combination = (m, n) => { return factorial(m, n) / factorial(n, n); };
const factorial = (m, n) => { let num = 1n; let cnt = 0; for (let i = ll(m); i > 0; i--) { if (cnt == n) break; num *= i; cnt++; } return num; };
const gcd = (a, b) => b == 0 ? a : gcd(b, a % b);
const lcm = (a, b) => (a / gcd(a, b)) * b;
const bitCount = (n) => { n = n - ((n >> 1) & 0x55555555); n = (n & 0x33333333) + ((n >> 2) & 0x33333333); return ((n + (n >> 4) & 0xF0F0F0F) * 0x1010101) >> 24; };
const powmod = (a, b, mod) => { let r = 1n; while (b > 0n) { if (b % 2n == 1) r = r * a % mod; b >>= 1n; a = a * a % mod; } return r; };
const amax = (a) => mx.apply(Math, a);
const amin = (a) => mi.apply(Math, a);
const sm = (a) => a.reduce(((x, y) => x + y), 0);
const aeq = (a, b) => JSON.stringify(a) == JSON.stringify(b);
const swap = (a, i, j) => [a[i], a[j]] = [a[j], a[i]];
const stin = (a) => a.sort((x, y) => x - y);
const stde = (a) => a.sort((x, y) => y - x);
const sortPart = (a, k) => { let l = a.slice(0, k); l.sort((x, y) => x - y); let r = a.slice(k); return l.concat(r); }; // sort first kth
const initialize2DArrayNew = (m, n) => { let data = []; for (let i = 0; i < m; i++) { let tmp = Array(n).fill(0); data.push(tmp); } return data; };
const stmkey_in = (m) => new Map([...m].sort((x, y) => x[0] - y[0]));
const stmkey_de = (m) => new Map([...m].sort((x, y) => y[0] - x[0]));
const stmvalue_in = (m) => new Map([...m].sort((x, y) => x[1] - y[1]));
const stmvalue_de = (m) => new Map([...m].sort((x, y) => y[1] - x[1]));
const counter = (a_or_s) => { let map = new Map(); for (const i of a_or_s) map.set(i, map.get(i) + 1 || 1); return map; };
const counter_value_in_indexA_in = (a_or_s) => { let m = new Map(); let n = a_or_s.length; for (let i = 0; i < n; i++) { if (!m.has(a_or_s[i])) m.set(a_or_s[i], []); m.get(a_or_s[i]).push(i); } return m; };
const counter_value_in_indexA_de = (a_or_s) => { let m = new Map(); let n = a_or_s.length; for (let i = 0; i < n; i++) { if (!m.has(a_or_s[i])) m.set(a_or_s[i], []); m.get(a_or_s[i]).unshift(i); } return m; };
const reverse2 = (s) => { let res = ""; for (let i = s.length - 1; i >= 0; i--) { res += s[i]; } return res; };
const isPalindrome = (s) => { let n = s.length; let i = 0; let j = n - 1; while (i < j) { if (s[i++] != s[j--]) return false; } return true; };
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

const solve = (n, m, g) => {
    // pr(n, m, g);
    let res1 = generate(n, m, 'W');
    let res2 = generate(n, m, 'R');
    if (ok(g, res1)) {
        pr('YES');
        // pr("res1", res1);
        res1 = res1.map(x => x.join(""));
        for (const s of res1) pr(s);
    } else if (ok(g, res2)) {
        pr('YES');
        res2 = res2.map(x => x.join(""));
        for (const s of res2) pr(s);
    } else {
        pr('NO');
    }
};

const ok = (g, t) => {
    let n = g.length;
    let m = g[0].length;
    for (let i = 0; i < n; i++) {
        for (let j = 0; j < m; j++) {
            if (g[i][j] == '.') continue;
            if (g[i][j] != t[i][j]) return false;
        }
    }
    return true;
};

const generate = (n, m, start) => {
    let res = [];
    let c = start;
    for (let i = 0; i < n; i++) {
        let tmp = [];
        for (let j = 0; j < m; j++) {
            tmp.push(c = transfer(c));
        }
        start = transfer(start);
        c = start;
        res.push(tmp);
    }
    return res;
};

const transfer = (c) => {
    return c == 'W' ? 'R' : 'W';
};

const main = () => {
    const readline = require('readline');
    const rl = readline.createInterface({
        input: process.stdin,
        output: process.stdout
    });
    let input = [];
    rl.on('line', (line) => {
        input.push(line);
    });
    rl.on('close', () => {
        let t = Number(input[0]);
        let i = 1;
        while (t--) {
            let s = input[i];
            let a = s.split(" ").map(Number);
            let [n, m] = [a[0], a[1]];
            let tmp = input.slice(i + 1, i + n + 1);
            tmp = tmp.map(s => s.split(""));
            solve(n, m, tmp);
            i += n + 1;
        }
    });
};

main()

const lib = require('readline');
const rl = lib.createInterface({
    input: process.stdin,
    output: process.stdout
});

const getLine = (function () {
    const getLineGen = (async function* () {
        for await (const line of rl) {
            yield line;
        }
    })();
    return async () => ((await getLineGen.next()).value);
})();

let solve = async () => {
    const nsc = parseInt(await getLine());
    for (let sc = 0; sc < nsc; sc++) {
        let n, m;
        [n, m] = (await getLine()).split(' ').map(num => parseInt(num));
        const table = new Array(n);
        for (let i = 0; i < n; i++)
            table[i] = (await getLine()).split("");
        let fail = false;
        let dfs = function (row, col) {
            let delta = [-1, 0, 1];
            for (let i = 0; i < 3; i++)
                for (let j = 0; j < 3; j++) {
                    if (Math.abs(delta[i]) + Math.abs(delta[j]) === 1) {
                        let nrow = row + delta[i];
                        let ncol = col + delta[j];
                        if (nrow >= 0 && nrow < n && ncol >= 0 && ncol < m) {
                            if (table[nrow][ncol] === table[row][col])
                                return -1;
                            else if (table[nrow][ncol] === '.') {
                                if (table[row][col] == 'R')
                                    table[nrow][ncol] = 'W';
                                else
                                    table[nrow][ncol] = 'R';
                                if (dfs(nrow, ncol) < 0)
                                    return -1;
                            }
                        }
                    }
                }
            return 0;
        }

        for (let row = 0; row < n && !fail; row++)
            for (let col = 0; col < m && !fail; col++)
                if (table[row][col] !== '.') {
                    if (dfs(row, col) < 0) {
                        fail = true;
                    }
                }
        if (table[0][0] === '.') {
            table[0][0] = 'R';
            if (dfs(0,0) < 0)
                faile = true;
        }
        if (fail)
            console.log('NO');
        else {
            console.log('YES');
            for (let row = 0; row < n; row++)
                console.log(table[row].join(''));
        }
    }
}

solve();

'use strict';

process.stdin.resume();
process.stdin.setEncoding('utf-8');

let inputString = '';
let currentLine = 0;

process.stdin.on('data', inputStdin => {
    inputString += inputStdin;
});

process.stdin.on('end', _ => {
    inputString = inputString.trim().split('\n').map(string => {
        return string.trim();
    });

    main();
});

function readline() {
    return inputString[currentLine++];
}

function printGrid(grid) {
  for (let x = 0; x < grid.length; x++) {
    console.log(grid[x].join(''));
  }
}

function main() {
  const testCaseCount = readline();

  for (let i = 0; i < testCaseCount; i++) {
    const [x] = readline().split(" ").map(n => parseInt(n));
    const grid = [];
    let isOkTestCase = true;
    let first = '.';
    let second = '.';

    for (let j = 0; j < x; j++) {
      const line = readline().split("");
      grid.push(line);
      const r = line.indexOf('R');
      const w = line.indexOf('W');
      if (first == '.' && second == '.') {
        if (r !== -1) {
          if (j % 2 == 0 && r % 2 == 0 || j % 2 != 0 && r % 2 != 0) {
            first = 'R';
            second = 'W';
          } else {
            first = 'W';
            second = 'R';
          }
        }
        if (w !== -1) {
          if (j % 2 == 0 && r % 2 == 0 || j % 2 != 0 && r % 2 != 0) {
            first = 'W';
            second = 'R';
          } else {
            first = 'R';
            second = 'W';
          }
        }
      }
    }

    if (first == '.' || second == '.') {
      first = 'R';
      second = 'W';
    }

    let color = '.';
    forloop:
    for (let x = 0; x < grid.length; x++) {
      for (let y = 0; y < grid[x].length; y++) {
        if (x % 2 == 0 && y % 2 == 0 || x % 2 != 0 && y % 2 != 0) {
          color = first;
          if (grid[x][y] == '.') {
            grid[x][y] = color;
          } else if (grid[x][y] != color) {
            isOkTestCase = false;
            break forloop;
          }
        } else {
          color = second;
          if (grid[x][y] == '.') {
            grid[x][y] = color;
          } else if (grid[x][y] != color) {
            isOkTestCase = false;
            break forloop;
          }
        }
      }
    }

    if (isOkTestCase) {
      console.log('YES');
      printGrid(grid);
    } else {
      console.log('NO');
    }
  }
}

'use strict';

process.stdin.resume();
process.stdin.setEncoding('utf-8');

let inputString = '';
let currentLine = 0;

process.stdin.on('data', inputStdin => {
    inputString += inputStdin;
});

process.stdin.on('end', _ => {
    inputString = inputString.trim().split('\n').map(string => {
        return string.trim();
    });

    main();
});

function readline() {
    return inputString[currentLine++];
}

function printGrid(grid) {
  for (let x = 0; x < grid.length; x++) {
    console.log(grid[x].join(''));
  }
}

function main() {
  const testCaseCount = readline();

  for (let i = 0; i < testCaseCount; i++) {
    const [x] = readline().split(" ").map(n => parseInt(n));
    const grid = [];
    let isOkTestCase = true;
    let first = '.';
    let second = '.';

    for (let j = 0; j < x; j++) {
      const line = readline().split("");
      grid.push(line);
      const r = line.indexOf('R');
      const w = line.indexOf('W');
      if (first == '.' && second == '.') {
        if (r !== -1) {
          if (j % 2 == 0 && r % 2 == 0 || j % 2 != 0 && r % 2 != 0) {
            first = 'R';
            second = 'W';
          } else {
            first = 'W';
            second = 'R';
          }
        }
        if (w !== -1) {
          if (j % 2 == 0 && r % 2 == 0 || j % 2 != 0 && r % 2 != 0) {
            first = 'W';
            second = 'R';
          } else {
            first = 'R';
            second = 'W';
          }
        }
      }
    }

    let color = '.';
    forloop:
    for (let x = 0; x < grid.length; x++) {
      for (let y = 0; y < grid[x].length; y++) {
        if (x % 2 == 0 && y % 2 == 0 || x % 2 != 0 && y % 2 != 0) {
          color = first;
          if (grid[x][y] == '.') {
            grid[x][y] = color;
          } else if (grid[x][y] != color) {
            isOkTestCase = false;
            break forloop;
          }
        } else {
          color = second;
          if (grid[x][y] == '.') {
            grid[x][y] = color;
          } else if (grid[x][y] != color) {
            isOkTestCase = false;
            break forloop;
          }
        }
      }
    }

    if (isOkTestCase) {
      console.log('YES');
      printGrid(grid);
    } else {
      console.log('NO');
    }
  }
}

'use strict';

process.stdin.resume();
process.stdin.setEncoding('utf-8');

let inputString = '';
let currentLine = 0;

process.stdin.on('data', inputStdin => {
    inputString += inputStdin;
});

process.stdin.on('end', _ => {
    inputString = inputString.trim().split('\n').map(string => {
        return string.trim();
    });

    main();
});

function readline() {
    return inputString[currentLine++];
}

function printGrid(grid) {
  for (let x = 0; x < grid.length; x++) {
    console.log(grid[x].join(''));
  }
}

function main() {
  const testCaseCount = readline();

  for (let i = 0; i < testCaseCount; i++) {
    const [x, y] = readline().split(" ").map(n => parseInt(n));
    const grid = [];
    let isOkTestCase = true;
    let first = '.';
    let second = '.';

    for (let j = 0; j < x; j++) {
      const line = readline().split("");
      grid.push(line);
      const r = line.indexOf('R');
      const w = line.indexOf('W');
      if (first == '.' && second == '.') {
        if (r !== -1) {
          if (j % 2 == 0 && r % 2 == 0 || j % 2 != 0 && r % 2 != 0) {
            first = 'R';
            second = 'W';
          } else {
            first = 'W';
            second = 'R';
          }
        }
        if (w !== -1) {
          if (j % 2 == 0 && r % 2 == 0 || j % 2 != 0 && r % 2 != 0) {
            first = 'W';
            second = 'R';
          } else {
            first = 'R';
            second = 'W';
          }
        }
      }
    }

    let color = '.';
    forloop:
    for (let x = 0; x < grid.length; x++) {
      for (let y = 0; y < grid[x].length; y++) {
        if (x % 2 == 0 && y % 2 == 0 || x % 2 != 0 && y % 2 != 0) {
          color = first;
          if (grid[x][y] == '.') {
            grid[x][y] = color;
          } else if (grid[x][y] != color) {
            isOkTestCase = false;
            break forloop;
          }
        } else {
          color = second;
          if (grid[x][y] == '.') {
            grid[x][y] = color;
          } else if (grid[x][y] != color) {
            isOkTestCase = false;
            break forloop;
          }
        }
      }
    }

    if (isOkTestCase) {
      console.log('YES');
      printGrid(grid);
    } else {
      console.log('NO');
    }
  }
}

'use strict';

process.stdin.resume();
process.stdin.setEncoding('utf-8');

let inputString = '';
let currentLine = 0;

process.stdin.on('data', inputStdin => {
    inputString += inputStdin;
});

process.stdin.on('end', _ => {
    inputString = inputString.trim().split('\n').map(string => {
        return string.trim();
    });

    main();
});

function readline() {
    return inputString[currentLine++];
}

function isDifferentNeighborTwo(c1, c2) {
  if (!c1 || !c2 || c1 == '.' || c2 == '.') return false;
  if (c1 != c2) return true; else return false;
}

function isEqualNeighbor(c1, c2) {
  if (!c1 || !c2 || c1 == '.' || c2 == '.') return false;
  if (c1 == c2) return true; else return false;
}

function isOkGrid(grid) {
  for (let x = 0; x < grid.length; x++) {
    for (let y = 0; y < grid[x].length; y++) {
      for (let i = -2; i <= 2; i = i + 4) {
        const x2 = x + i;
        if (x2 >= 0 && x2 < grid.length)
          if (isDifferentNeighborTwo(grid[x][y], grid[x2][y]))
            return false;
        const y2 = y + i;
        if (y2 >= 0 && y2 < grid.length)
          if (isDifferentNeighborTwo(grid[x][y], grid[x][y2]))
            return false;
      }
      for (let i = -1; i <= 1; i = i + 2) {
        const x2 = x + i;
        if (x2 >= 0 && x2 < grid.length)
          if (isEqualNeighbor(grid[x][y], grid[x2][y]))
            return false;
        const y2 = y + i;
        if (y2 >= 0 && y2 < grid.length)
          if (isEqualNeighbor(grid[x][y], grid[x][y2]))
            return false;
      }
    }
  }
  return true;
}

function isGridComplete(grid) {
  for (let x = 0; x < grid.length; x++) {
    for (let y = 0; y < grid[x].length; y++) {
      if (grid[x][y] == '.') return false;
    }
  }
  return true;
}

function printGrid(grid) {
  for (let x = 0; x < grid.length; x++) {
    console.log(grid[x].join(''));
  }
}

function main() {
  const testCaseCount = readline();

  for (let i = 0; i < testCaseCount; i++) {
    const [x, y] = readline().split(" ").map(n => parseInt(n));
    const grid = [];
    let isOkTestCase = true;
    let first = '.';
    let second = '.';

    for (let j = 0; j < x; j++) {
      const line = readline().split("");
      grid.push(line);
      const r = line.indexOf('R');
      const w = line.indexOf('W');
      if (first == '.' && second == '.') {
        if (r !== -1) {
          if (j % 2 == 0 && r % 2 == 0 || j % 2 != 0 && r % 2 != 0) {
            first = 'R';
            second = 'W';
          } else {
            first = 'W';
            second = 'R';
          }
        }
        if (w !== -1) {
          if (j % 2 == 0 && r % 2 == 0 || j % 2 != 0 && r % 2 != 0) {
            first = 'W';
            second = 'R';
          } else {
            first = 'R';
            second = 'W';
          }
        }
      }
    }

    let color = '.';
    forloop:
    for (let x = 0; x < grid.length; x++) {
      for (let y = 0; y < grid[x].length; y++) {
        if (x % 2 == 0 && y % 2 == 0 || x % 2 != 0 && y % 2 != 0) {
          color = first;
          if (grid[x][y] == '.') {
            grid[x][y] = color;
          } else if (grid[x][y] != color) {
            isOkTestCase = false;
            break forloop;
          }
        } else {
          color = second;
          if (grid[x][y] == '.') {
            grid[x][y] = color;
          } else if (grid[x][y] != color) {
            isOkTestCase = false;
            break forloop;
          }
        }
      }
    }

    if (isOkTestCase) {
      console.log('YES');
      printGrid(grid);
    } else {
      console.log('NO');
    }
  }
}

'use strict';

process.stdin.resume();
process.stdin.setEncoding('utf-8');

let inputString = '';
let currentLine = 0;

process.stdin.on('data', inputStdin => {
    inputString += inputStdin;
});

process.stdin.on('end', _ => {
    inputString = inputString.trim().split('\n').map(string => {
        return string.trim();
    });

    main();
});

function readline() {
    return inputString[currentLine++];
}

function isDifferentNeighborTwo(x1, y1, x2, y2, grid) {
  if (x2 < 0 || y2 < 0) return false;
  if (x2 >= grid.length || y2 >= grid[x2].length) return false;
  if (grid[x1][y1] == '.' || grid[x2][y2] == '.') return false;
  if (grid[x1][y1] != grid[x2][y2]) return true; else return false;
}

function isEqualNeighbor(x1, y1, x2, y2, grid) {
  if (x2 < 0 || y2 < 0) return false;
  if (x2 >= grid.length || y2 >= grid[x2].length) return false;
  if (grid[x1][y1] == '.' || grid[x2][y2] == '.') return false;
  if (grid[x1][y1] == grid[x2][y2]) return true; else return false;
}

function isOkCell(x, y, grid) {
  if (
    isEqualNeighbor(x, y, x-1, y, grid) ||
    isEqualNeighbor(x, y, x+1, y, grid) ||
    isEqualNeighbor(x, y, x, y-1, grid) ||
    isEqualNeighbor(x, y, x, y+1, grid) ||

    isDifferentNeighborTwo(x, y, x-2, y, grid) ||
    isDifferentNeighborTwo(x, y, x+2, y, grid) ||
    isDifferentNeighborTwo(x, y, x, y-2, grid) ||
    isDifferentNeighborTwo(x, y, x, y+2, grid)
  ) return false; else return true;
}

function isOkGrid(grid) {
  for (let x = 0; x < grid.length; x++) {
    for (let y = 0; y < grid[x].length; y++) {
      if (!isOkCell(x, y, grid)) return false;
    }
  }
  return true;
}

function fillCell(x, y, grid, color) {
  if (x < 0 || y < 0) return;
  if (x >= grid.length || y >= grid[x].length) return;
  if (grid[x][y] != '.') return;
  grid[x][y] = color;
}

function fillNeighborCells(x, y, grid) {
  if (grid[x][y] == 'R') {
    fillCell(x-1, y, grid, 'W');
    fillCell(x+1, y, grid, 'W');
    fillCell(x, y-1, grid, 'W');
    fillCell(x, y+1, grid, 'W');
  } else {
    fillCell(x-1, y, grid, 'R');
    fillCell(x+1, y, grid, 'R');
    fillCell(x, y-1, grid, 'R');
    fillCell(x, y+1, grid, 'R');
  }
}

function isGridComplete(grid) {
  for (let x = 0; x < grid.length; x++) {
    for (let y = 0; y < grid[x].length; y++) {
      if (grid[x][y] == '.') return false;
    }
  }
  return true;
}

function fillGrid(grid) {
  for (let x = 0; x < grid.length; x++) {
    for (let y = 0; y < grid[x].length; y++) {
      fillNeighborCells(x, y, grid);
    }
  }
}

function printGrid(grid) {
  for (let x = 0; x < grid.length; x++) {
    console.log(grid[x].join(''));
  }
}

function main() {
  const testCaseCount = readline();
  const testCases = [];

  for (let i = 0; i < testCaseCount; i++) {
    const [x, y] = readline().split(" ").map(n => parseInt(n));
    const grid = [];

    for (let j = 0; j < x; j++) {
      const line = readline().split("");
      grid.push(line);
    }

    testCases.push({ x, y, grid });
  }

  testCases.forEach((testCase) => {
    if (isOkGrid(testCase.grid)) {
      testCase.isOk = true;
    } else {
      testCase.isOk = false;
    }
  });

  testCases.forEach((testCase) => {
    if (testCase.isOk) {
      fillGrid(testCase.grid);
    }
  });

  testCases.forEach((testCase) => {
    if (isOkGrid(testCase.grid)) {
      testCase.isOk = true;
    } else {
      testCase.isOk = false;
    }
  });

  testCases.forEach((testCase) => {
    if (testCase.isOk) {
      console.log('YES');
      printGrid(testCase.grid);
    } else {
      console.log('NO');
    }
  });
}

'use strict';

process.stdin.resume();
process.stdin.setEncoding('utf-8');

let inputString = '';
let currentLine = 0;

process.stdin.on('data', inputStdin => {
    inputString += inputStdin;
});

process.stdin.on('end', _ => {
    inputString = inputString.trim().split('\n').map(string => {
        return string.trim();
    });

    main();
});

function readline() {
    return inputString[currentLine++];
}

function isDifferentNeighborTwo(x1, y1, x2, y2, grid) {
  if (x2 < 0 || y2 < 0) return false;
  if (x2 >= grid.length || y2 >= grid[x2].length) return false;
  if (grid[x1][y1] == '.' || grid[x2][y2] == '.') return false;
  if (grid[x1][y1] != grid[x2][y2]) return true; else return false;
}

function isEqualNeighbor(x1, y1, x2, y2, grid) {
  if (x2 < 0 || y2 < 0) return false;
  if (x2 >= grid.length || y2 >= grid[x2].length) return false;
  if (grid[x1][y1] == '.' || grid[x2][y2] == '.') return false;
  if (grid[x1][y1] == grid[x2][y2]) return true; else return false;
}

function isOkCell(x, y, grid) {
  if (
    isEqualNeighbor(x, y, x-1, y, grid) ||
    isEqualNeighbor(x, y, x+1, y, grid) ||
    isEqualNeighbor(x, y, x, y-1, grid) ||
    isEqualNeighbor(x, y, x, y+1, grid) ||

    isDifferentNeighborTwo(x, y, x-2, y, grid) ||
    isDifferentNeighborTwo(x, y, x+2, y, grid) ||
    isDifferentNeighborTwo(x, y, x, y-2, grid) ||
    isDifferentNeighborTwo(x, y, x, y+2, grid)
  ) return false; else return true;
}

function isOkGrid(grid) {
  for (let x = 0; x < grid.length; x++) {
    for (let y = 0; y < grid[x].length; y++) {
      if (!isOkCell(x, y, grid)) return false;
    }
  }
  return true;
}

function fillCell(x, y, grid, color) {
  if (x < 0 || y < 0) return;
  if (x >= grid.length || y >= grid[x].length) return;
  if (grid[x][y] != '.') return;
  grid[x][y] = color;
}

function fillNeighborCells(x, y, grid) {
  if (grid[x][y] == 'R') {
    fillCell(x-1, y, grid, 'W');
    fillCell(x+1, y, grid, 'W');
    fillCell(x, y-1, grid, 'W');
    fillCell(x, y+1, grid, 'W');
  } else {
    fillCell(x-1, y, grid, 'R');
    fillCell(x+1, y, grid, 'R');
    fillCell(x, y-1, grid, 'R');
    fillCell(x, y+1, grid, 'R');
  }
}

function isGridComplete(grid) {
  for (let x = 0; x < grid.length; x++) {
    for (let y = 0; y < grid[x].length; y++) {
      if (grid[x][y] == '.') return false;
    }
  }
  return true;
}

function fillGrid(grid) {
  for (let x = 0; x < grid.length; x++) {
    for (let y = 0; y < grid[x].length; y++) {
      fillNeighborCells(x, y, grid);
    }
  }
}

function printGrid(grid) {
  for (let x = 0; x < grid.length; x++) {
    console.log(grid[x].join(''));
  }
}

function main() {
  const testCaseCount = readline();
  const testCases = [];

  for (let i = 0; i < testCaseCount; i++) {
    const [x, y] = readline().split(" ").map(n => parseInt(n));
    const grid = [];

    for (let j = 0; j < x; j++) {
      const line = readline().split("");
      grid.push(line);
    }

    testCases.push({ x, y, grid });
  }

  testCases.forEach((testCase) => {
    if (isOkGrid(testCase.grid)) {
      testCase.isOk = true;
    } else {
      testCase.isOk = false;
    }
  });

  testCases.forEach((testCase) => {
    if (testCase.isOk) {
      fillGrid(testCase.grid);
    }
  });

  testCases.forEach((testCase) => {
    if (testCase.isOk) {
      console.log('YES');
      printGrid(testCase.grid);
    } else {
      console.log('NO');
    }
  });
}

'use strict';

process.stdin.resume();
process.stdin.setEncoding('utf-8');

let inputString = '';
let currentLine = 0;

process.stdin.on('data', inputStdin => {
    inputString += inputStdin;
});

process.stdin.on('end', _ => {
    inputString = inputString.trim().split('\n').map(string => {
        return string.trim();
    });

    main();
});

function readline() {
    return inputString[currentLine++];
}

function isDifferentNeighborTwo(c1, c2) {
  if (!c1 || !c2 || c1 == '.' || c2 == '.') return false;
  if (c1 != c2) return true; else return false;
}

function isEqualNeighbor(c1, c2) {
  if (!c1 || !c2 || c1 == '.' || c2 == '.') return false;
  if (c1 == c2) return true; else return false;
}

function isOkGrid(grid) {
  for (let x = 0; x < grid.length; x++) {
    for (let y = 0; y < grid[x].length; y++) {
      for (let i = -2; i <= 2; i = i + 4) {
        const x2 = x + i;
        if (x2 >= 0 && x2 < grid.length)
          if (isDifferentNeighborTwo(grid[x][y], grid[x2][y]))
            return false;
        const y2 = y + i;
        if (y2 >= 0 && y2 < grid.length)
          if (isDifferentNeighborTwo(grid[x][y], grid[x][y2]))
            return false;
      }
      for (let i = -1; i <= 1; i = i + 2) {
        const x2 = x + i;
        if (x2 >= 0 && x2 < grid.length)
          if (isEqualNeighbor(grid[x][y], grid[x2][y]))
            return false;
        const y2 = y + i;
        if (y2 >= 0 && y2 < grid.length)
          if (isEqualNeighbor(grid[x][y], grid[x][y2]))
            return false;
      }
    }
  }
  return true;
}

function isGridComplete(grid) {
  for (let x = 0; x < grid.length; x++) {
    for (let y = 0; y < grid[x].length; y++) {
      if (grid[x][y] == '.') return false;
    }
  }
  return true;
}

function printGrid(grid) {
  for (let x = 0; x < grid.length; x++) {
    console.log(grid[x].join(''));
  }
}

function main() {
  const testCaseCount = readline();

  for (let i = 0; i < testCaseCount; i++) {
    const [x, y] = readline().split(" ").map(n => parseInt(n));
    const grid = [];

    for (let j = 0; j < x; j++) {
      const line = readline().split("");
      grid.push(line);
    }

    if (isOkGrid(grid)) {
      let color = '.';
      for (let x = 0; x < grid.length; x++) {
        for (let y = 0; y < grid[x].length; y++) {
          if (grid[x][y] == 'R') {
            color = 'W';
          } else {
            color = 'R';
          }
          for (let i = -1; i <= 1; i = i + 2) {
            const x2 = x + i;
            if (x2 >= 0 && x2 < grid.length) {
              if (grid[x2][y] == '.')
                grid[x2][y] = color;
            }
            const y2 = y + i;
            if (y2 >= 0 && y2 < grid[x].length) {
              if (grid[x][y2] == '.')
                grid[x][y2] = color;
            }
          }
        }
      }
      console.log('YES');
      printGrid(grid);
    } else {
      console.log('NO');
    }
  }
}

'use strict';

process.stdin.resume();
process.stdin.setEncoding('utf-8');

let inputString = '';
let currentLine = 0;

process.stdin.on('data', inputStdin => {
    inputString += inputStdin;
});

process.stdin.on('end', _ => {
    inputString = inputString.trim().split('\n').map(string => {
        return string.trim();
    });

    main();
});

function readline() {
    return inputString[currentLine++];
}

function isDifferentNeighborTwo(c1, c2) {
  if (!c1 || !c2 || c1 == '.' || c2 == '.') return false;
  if (c1 != c2) return true; else return false;
}

function isEqualNeighbor(c1, c2) {
  if (!c1 || !c2 || c1 == '.' || c2 == '.') return false;
  if (c1 == c2) return true; else return false;
}

function isOkGrid(grid) {
  for (let x = 0; x < grid.length; x++) {
    for (let y = 0; y < grid[x].length; y++) {
      for (let i = -2; i <= 2; i = i + 4) {
        const x2 = x + i;
        if (x2 >= 0 && x2 < grid.length)
          if (isDifferentNeighborTwo(grid[x][y], grid[x2][y]))
            return false;
        const y2 = y + i;
        if (y2 >= 0 && y2 < grid.length)
          if (isDifferentNeighborTwo(grid[x][y], grid[x][y2]))
            return false;
      }
      for (let i = -1; i <= 1; i = i + 2) {
        const x2 = x + i;
        if (x2 >= 0 && x2 < grid.length)
          if (isEqualNeighbor(grid[x][y], grid[x2][y]))
            return false;
        const y2 = y + i;
        if (y2 >= 0 && y2 < grid.length)
          if (isEqualNeighbor(grid[x][y], grid[x][y2]))
            return false;
      }
    }
  }
  return true;
}

function isGridComplete(grid) {
  for (let x = 0; x < grid.length; x++) {
    for (let y = 0; y < grid[x].length; y++) {
      if (grid[x][y] == '.') return false;
    }
  }
  return true;
}

function printGrid(grid) {
  for (let x = 0; x < grid.length; x++) {
    console.log(grid[x].join(''));
  }
}

function main() {
  const testCaseCount = readline();

  for (let i = 0; i < testCaseCount; i++) {
    const [x, y] = readline().split(" ").map(n => parseInt(n));
    const grid = [];

    for (let j = 0; j < x; j++) {
      const line = readline().split("");
      grid.push(line);
    }

    if (isOkGrid(grid)) {
      let color = '.';
      for (let x = 0; x < grid.length; x++) {
        for (let y = 0; y < grid[x].length; y++) {
          if (grid[x][y] == 'R') {
            color = 'W';
          } else {
            color = 'R';
          }
          for (let i = -1; i <= 1; i = i + 2) {
            const x2 = x + i;
            if (x2 >= 0 && x2 < grid.length) {
              grid[x2][y] = color;
            }
            const y2 = y + i;
            if (y2 >= 0 && y2 < grid[x].length) {
              grid[x][y2] = color;
            }
          }
        }
      }
      console.log('YES');
      printGrid(grid);
    } else {
      console.log('NO');
    }
  }
}

//Don't have to see. start------------------------------------------
var read = require('readline').createInterface({
	input: process.stdin, output: process.stdout
});
var obj; var inLine = []; var outputList = [];var retcode = new Set();
read.on('line', function(input){
	var tmp = input.split(' ');
	for(var i = 0; i < tmp.length; i++){
		inLine.push(tmp[i]);
		if(i == tmp.length - 1){
			retcode.add(inLine.length);
		}
	}
});
read.on('close', function(){
	obj = init(inLine);
	console.error('\n↑入力 ↓出力');
	Main();
	console.log(myconv(outputList, 9));
});
function makeClone(obj){return (obj instanceof Set) ? new Set(Array.from(obj)) : JSON.parse(JSON.stringify(obj));}
function nextArray(size, code){
	var ret = new Array(size);
	for(var i = 0; i < size; i++){
		if(code == 'int'){
			ret[i] = nextInt();
		}else if(code == 'long'){
			ret[i] = BigInt(next());
		}else{
			ret[i] = next();
		}
	}
	return ret;
}
function nextIntArray(size){return nextArray(size, 'int');} function nextStrArray(size){return nextArray(size, 'str');} function nextLongArray(size){return nextArray(size, 'long');}
function nextCharArray(){return myconv(next(),6);}
function next(){return obj.next();} function hasNext(){return obj.hasNext();} function nextInt(){return myconv(next(),1);} function nextLong(){return BigInt(next());}
function getCountMap(list){
	var map = {};
	for(var i = 0; i < list.length; i++){
		if(map[list[i]] == null){
			map[list[i]] = 0;
		}
		map[list[i]]++;
	}
	return map;
}
function init(input){
	return {
		list : input, index : 0, max : input.length,
		hasNext : function(){return (this.index < this.max);},
		next : function(){if(this.hasNext()){return this.list[this.index++];}else{throw 'ArrayIndexOutOfBoundsException ‚There is no more input';}},
		isReturn : function(){return retcode.has(this.index);}
	};
}
function myout(s){outputList.push(s);}
function myerr(s){console.error('debug:' + require('util').inspect(s,false,null));}
function isReturn(){return obj.isReturn();}
//param "no" is
//unknown or outlier : return i. 1: parseInt.
//2: split space. 4: split space and parseInt.
//6: split 1 character. 7: split 1 character and parseInt.
//8: join space. 9: join nextline. 0: join no character.
function myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(' ');case 4:return i.split(' ').map(Number);case 6:return i.split('');case 7:return i.split('').map(Number);case 8:return i.join(' ');case 9:return i.join('\n');case 0:return i.join('');default:return i;}}catch(e){return i;}}

//Don't have to see. end------------------------------------------
function Main(){
	var t = nextInt();
	var dy = [-1,0,1,0];
	var dx = [0,-1,0,1];
	while(hasNext()){
		var H = nextInt();
		var W = nextInt();
		var s = new Array(H);
		for(var i = 0; i < H; i++){
			s[i] = nextCharArray();
		}
		var queue = [];
		for(var i = 0; i < H; i++){
			for(var j = 0; j < W; j++){
				if(s[i][j] != "."){
					queue.push([i,j]);
				}
			}
		}
		if(queue.length == 0){
			queue.push([0,0]);
		}
		while(queue.length > 0){
			var tmp = queue.shift();
			var y = tmp[0];
			var x = tmp[1];
			for(var j = 0; j < dy.length; j++){
				var nextY = y + dy[j];
				var nextX = x + dx[j];
				if(nextY >= 0 && nextY < H && nextX >= 0 && nextX < W){
					if(s[nextY][nextX] == "."){
						if(s[y][x] == "R"){
							s[nextY][nextX] = "W";
						}else{
							s[nextY][nextX] = "R";
						}
						queue.push([nextY, nextX]);
					}
				}
			}
		}
		var isOK = true;
		for(var i = 0; i < H - 1; i++){
			for(var j = 0; j < W; j++){
				if(s[i][j] == s[i + 1][j]){
					isOK = false;
				}
			}
		}
		for(var i = 0; i < H; i++){
			for(var j = 0; j < W - 1; j++){
				if(s[i][j] == s[i][j + 1]){
					isOK = false;
				}
			}
		}
		myout((isOK) ? "Yes" : "No");
		if(isOK){
			for(var i = 0; i < H; i++){
				myout(myconv(s[i], 0));
			}
		}
	}
}

//Don't have to see. start------------------------------------------
var read = require('readline').createInterface({
	input: process.stdin, output: process.stdout
});
var obj; var inLine = []; var outputList = [];var retcode = new Set();
read.on('line', function(input){
	var tmp = input.split(' ');
	for(var i = 0; i < tmp.length; i++){
		inLine.push(tmp[i]);
		if(i == tmp.length - 1){
			retcode.add(inLine.length);
		}
	}
});
read.on('close', function(){
	obj = init(inLine);
	console.error('\n↑入力 ↓出力');
	Main();
	console.log(myconv(outputList, 9));
});
function makeClone(obj){return (obj instanceof Set) ? new Set(Array.from(obj)) : JSON.parse(JSON.stringify(obj));}
function nextArray(size, code){
	var ret = new Array(size);
	for(var i = 0; i < size; i++){
		if(code == 'int'){
			ret[i] = nextInt();
		}else if(code == 'long'){
			ret[i] = BigInt(next());
		}else{
			ret[i] = next();
		}
	}
	return ret;
}
function nextIntArray(size){return nextArray(size, 'int');} function nextStrArray(size){return nextArray(size, 'str');} function nextLongArray(size){return nextArray(size, 'long');}
function nextCharArray(){return myconv(next(),6);}
function next(){return obj.next();} function hasNext(){return obj.hasNext();} function nextInt(){return myconv(next(),1);} function nextLong(){return BigInt(next());}
function getCountMap(list){
	var map = {};
	for(var i = 0; i < list.length; i++){
		if(map[list[i]] == null){
			map[list[i]] = 0;
		}
		map[list[i]]++;
	}
	return map;
}
function init(input){
	return {
		list : input, index : 0, max : input.length,
		hasNext : function(){return (this.index < this.max);},
		next : function(){if(this.hasNext()){return this.list[this.index++];}else{throw 'ArrayIndexOutOfBoundsException ‚There is no more input';}},
		isReturn : function(){return retcode.has(this.index);}
	};
}
function myout(s){outputList.push(s);}
function myerr(s){console.error('debug:' + require('util').inspect(s,false,null));}
function isReturn(){return obj.isReturn();}
//param "no" is
//unknown or outlier : return i. 1: parseInt.
//2: split space. 4: split space and parseInt.
//6: split 1 character. 7: split 1 character and parseInt.
//8: join space. 9: join nextline. 0: join no character.
function myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(' ');case 4:return i.split(' ').map(Number);case 6:return i.split('');case 7:return i.split('').map(Number);case 8:return i.join(' ');case 9:return i.join('\n');case 0:return i.join('');default:return i;}}catch(e){return i;}}

//Don't have to see. end------------------------------------------
function Main(){
	var t = nextInt();
	var dy = [-1,0,1,0];
	var dx = [0,-1,0,1];
	while(hasNext()){
		var H = nextInt();
		var W = nextInt();
		var s = new Array(H);
		for(var i = 0; i < H; i++){
			s[i] = nextCharArray();
		}
		var queue = [];
		for(var i = 0; i < H; i++){
			for(var j = 0; j < W; j++){
				if(s[i][j] != "."){
					queue.push([i,j]);
				}
			}
		}
		while(queue.length > 0){
			var tmp = queue.shift();
			var y = tmp[0];
			var x = tmp[1];
			for(var j = 0; j < dy.length; j++){
				var nextY = y + dy[j];
				var nextX = x + dx[j];
				if(nextY >= 0 && nextY < H && nextX >= 0 && nextX < W){
					if(s[nextY][nextX] == "."){
						if(s[y][x] == "R"){
							s[nextY][nextX] = "W";
						}else{
							s[nextY][nextX] = "R";
						}
						queue.push([nextY, nextX]);
					}
				}
			}
		}
		var isOK = true;
		for(var i = 0; i < H - 1; i++){
			for(var j = 0; j < W; j++){
				if(s[i][j] == s[i + 1][j]){
					isOK = false;
				}
			}
		}
		for(var i = 0; i < H; i++){
			for(var j = 0; j < W - 1; j++){
				if(s[i][j] == s[i][j + 1]){
					isOK = false;
				}
			}
		}
		myout((isOK) ? "Yes" : "No");
		if(isOK){
			for(var i = 0; i < H; i++){
				myout(myconv(s[i], 0));
			}
		}
	}
}

let i = "";
process.stdin.on("data", c => (i += c));
process.stdin.on("end", () => {
	const { EOL } = require("os");
	const lines = i.split(EOL);
	solve(lines);
});

function solve(lines) {
	const t = lines[0];
	let index = 1;
	for (let i = 0; i < t; i++) {
		const ij = lines[index++];
		const [n, m] = ij.split(" ").map(c => +c);
		let map = { R: [], W: [], ".": [] };
		for (let j = 0; j < n; j++) {
			const line = lines[index++];
			line.split("").forEach((c, k) => {
				map[c].push([(k + j) % 2, j, k]);
			});
		}
		let rVal = -1;
		map["R"].forEach(element => {
			if (rVal === -1) {
				rVal = element[0];
			} else if (element[0] !== rVal) {
				rVal = -2;
			}
		});
		let wVal = -1;
		map["W"].forEach(element => {
			if (wVal === -1) {
				wVal = element[0];
			} else if (element[0] !== wVal) {
				wVal = -2;
			}
		});
		if (rVal === -2 || wVal === -2 || rVal === wVal) {
			console.log("NO");
		} else {
			console.log("YES");
			if (rVal === -1) {
                if(wVal === 1)
				    rVal = 0;
                else
                    rVal = 1;
			}
			for (let l = 0; l < n; l++) {
				let res = "";
				for (let c = 0; c < m; c++) {
					if (rVal === (c + l) % 2) {
						res += "R";
					} else {
						res += "W";
					}
				}
				console.log(res);
			}
		}
	}
}

let i = ''
process.stdin.on('data', c => i += c)
process.stdin.on('end', () => {
    const {EOL} = require('os')
    const lines = i.split(EOL);
    solve(lines);
});

function solve(lines){
  const t = lines[0];
  let index = 1;
  for(let i =0; i < t; i++) {
      const ij = lines[index++];
      const [ n, m ] =  ij.split(" ").map(c=>+c);
      let map = { "R": [], "W": [], ".": [] };
      for(let j = 0; j < n; j++) {
          const line = lines[index++];
          line.split("").forEach((c, k) => {
            map[c].push([(k+j)%2 ,j, k]);

          });

      }
      let rVal = -1;
      map["R"].forEach((element) => {
          if(rVal === -1) {
              rVal = element[0];
          } else if(element[0] !== rVal){
              rVal = -2;
          }
      });
      let wVal = -1;
      map["W"].forEach((element) => {
          if(wVal === -1) {
            wVal = element[0];
          } else if(element[0] !== wVal){
            wVal = -2;
          }
      });
      if(rVal === -2 || wVal === -2 || rVal === wVal) {
          console.log("NO")
      } else {
          console.log("YES");
          for(let l = 0; l < n ; l++){
              let res = "";
              for(let c = 0; c < m ; c++) {
                  if(rVal === (c+l)%2) {
                      res+="R";
                  } else {
                      res+="W";
                  }
              }
              console.log(res);
          }
      }
  }
}


This is the easy version of the problem. The difference between the versions is that the easy version does not require you to output the numbers of the rods to be removed. You can make hacks only if all versions of the problem are solved.Stitch likes experimenting with different machines with his friend Sparky. Today they built another machine.The main element of this machine are $$$n$$$ rods arranged along one straight line and numbered from $$$1$$$ to $$$n$$$ inclusive. Each of these rods must carry an electric charge quantitatively equal to either $$$1$$$ or $$$-1$$$ (otherwise the machine will not work). Another condition for this machine to work is that the sign-variable sum of the charge on all rods must be zero.More formally, the rods can be represented as an array of $$$n$$$ numbers characterizing the charge: either $$$1$$$ or $$$-1$$$. Then the condition must hold: $$$a_1 - a_2 + a_3 - a_4 + \ldots = 0$$$, or $$$\sum\limits_{i=1}^n (-1)^{i-1} \cdot a_i = 0$$$.Sparky charged all $$$n$$$ rods with an electric current, but unfortunately it happened that the rods were not charged correctly (the sign-variable sum of the charge is not zero). The friends decided to leave only some of the rods in the machine. Sparky has $$$q$$$ questions. In the $$$i$$$th question Sparky asks: if the machine consisted only of rods with numbers $$$l_i$$$ to $$$r_i$$$ inclusive, what minimal number of rods could be removed from the machine so that the sign-variable sum of charges on the remaining ones would be zero? Perhaps the friends got something wrong, and the sign-variable sum is already zero. In that case, you don't have to remove the rods at all.If the number of rods is zero, we will assume that the sign-variable sum of charges is zero, that is, we can always remove all rods.Help your friends and answer all of Sparky's questions!

Each test contains multiple test cases. The first line contains one positive integer $$$t$$$ ($$$1 \le t \le 10^3$$$), denoting the number of test cases. Description of the test cases follows. The first line of each test case contains two positive integers $$$n$$$ and $$$q$$$ ($$$1 \le n, q \le 3 \cdot 10^5$$$) — the number of rods and the number of questions. The second line of each test case contains a non-empty string $$$s$$$ of length $$$n$$$, where the charge of the $$$i$$$-th rod is $$$1$$$ if $$$s_i$$$ is the "+" symbol, or $$$-1$$$ if $$$s_i$$$ is the "-" symbol. Each next line from the next $$$q$$$ lines contains two positive integers $$$l_i$$$ ans $$$r_i$$$ ($$$1 \le l_i \le r_i \le n$$$) — numbers, describing Sparky's questions. It is guaranteed that the sum of $$$n$$$ over all test cases does not exceed $$$3 \cdot 10^5$$$, and the sum of $$$q$$$ over all test cases does not exceed $$$3 \cdot 10^5$$$.

For each test case, print a single integer — the minimal number of rods that can be removed.

NoteIn the first test case for the first query you can remove the rods numbered $$$5$$$ and $$$8$$$, then the following set of rods will remain: +--+--++-++-. It is easy to see that here the sign-variable sum is zero.In the second test case:  For the first query, we can remove the rods numbered $$$1$$$ and $$$11$$$, then the following set of rods will remain: --++---++---. It is easy to see that here the sign-variable sum is zero.  For the second query we can remove the rod numbered $$$9$$$, then the following set of rods will remain: ---++-. It is easy to see that here the variable sum is zero.  For the third query we can not remove the rods at all.

'use strict'
var os = require('os')
function createInput(t) {
  const n = t.stdin || process.stdin,
    e = /-?\d+/g,
    r = /-?\d+(?:\.\d+)?/g
  let u = [],
    o = 0
  return {
    init: async function () {
      const t = []
      ;(u = await new Promise(e => {
        n.on('data', n => t.push(n)),
          n.on('end', function () {
            const n = t.join('').split(os.EOL)
            e(n)
          })
      })),
        (o = 0)
    },
    dried: function () {
      return o >= u.length
    },
    readLine: i,
    readLineAsNumber: function () {
      return Number(i())
    },
    readIntegersOfLine: function () {
      const t = i().match(e)
      return null == t ? [] : t.map(t => Number(t))
    },
    readNumsOfLine: function () {
      const t = i().match(r)
      return null == t ? [] : t.map(t => Number(t))
    },
  }
  function i() {
    return u[o++]
  }
}
function createOutput(t) {
  const n = t.stdout || process.stdout,
    e = t.encoding || 'ascii',
    r = t.outputBufferThreshold || 1 << 24,
    u = Buffer.alloc(r)
  let o = 0
  return {
    flush: i,
    print: function (t) {
      s('string' == typeof t ? t : t.toString())
    },
    println: function (t) {
      s(('string' == typeof t ? t : t.toString()).concat('\n'))
    },
  }
  function i() {
    n.write(u.toString(e, 0, o)), (o = 0)
  }
  function s(t) {
    const s = Buffer.byteLength(t, e)
    r - o < s && (i(), s >= r) ? n.write(t) : (u.write(t, o, e), (o += s))
  }
}
function createInputAndOutput(t) {
  return {
    ...createInput({ stdin: t.stdin, encoding: t.encoding }),
    ...createOutput({
      stdout: t.stdout,
      encoding: t.encoding,
      outputBufferThreshold: t.outputBufferThreshold,
    }),
  }
}
async function __main__(t, n, e = {}) {
  const r = createInputAndOutput(e)
  await Promise.all([r.init(), Promise.resolve(n && n())]),
    await t(r),
    r.flush()
}
const MAX_N = 300010,
  sum = new Array(MAX_N)
__main__(
  function (t) {
    const n = t.readLineAsNumber()
    sum[0] = 0
    for (let e = 1; e <= n; ++e) {
      const [n, e] = t.readIntegersOfLine(),
        r = t.readLine()
      for (let t = 0; t < n; ++t) {
        const n = r[t],
          e = (t + 1) & 1 ? ('+' === n ? 1 : -1) : '+' === n ? -1 : 1
        sum[t + 1] = sum[t] + e
      }
      for (let n = 1; n <= e; ++n) {
        const [n, e] = t.readIntegersOfLine(),
          r = (e - n + 1) & 1 ? 1 : sum[e] === sum[n - 1] ? 0 : 2
        t.println(r)
      }
    }
  },
  void 0,
  { outputBufferThreshold: 1 << 20 },
)

'use strict'
var os = require('os')
function createInput(t) {
  const n = t.stdin || process.stdin,
    e = /-?\d+/g,
    r = /-?\d+(?:\.\d+)?/g
  let u = [],
    o = 0
  return {
    init: async function () {
      const t = []
      ;(u = await new Promise(e => {
        n.on('data', n => t.push(n)),
          n.on('end', function () {
            const n = t.join('').split(os.EOL)
            e(n)
          })
      })),
        (o = 0)
    },
    dried: function () {
      return o >= u.length
    },
    readLine: i,
    readLineAsNumber: function () {
      return Number(i())
    },
    readIntegersOfLine: function () {
      const t = i().match(e)
      return null == t ? [] : t.map(t => Number(t))
    },
    readNumsOfLine: function () {
      const t = i().match(r)
      return null == t ? [] : t.map(t => Number(t))
    },
  }
  function i() {
    return u[o++]
  }
}
function createOutput(t) {
  const n = t.stdout || process.stdout,
    e = t.encoding || 'ascii',
    r = t.outputBufferThreshold || 1 << 24,
    u = Buffer.alloc(r)
  let o = 0
  return {
    flush: i,
    print: function (t) {
      s('string' == typeof t ? t : t.toString())
    },
    println: function (t) {
      s(('string' == typeof t ? t : t.toString()).concat('\n'))
    },
  }
  function i() {
    n.write(u.toString(e, 0, o)), (o = 0)
  }
  function s(t) {
    const s = Buffer.byteLength(t, e)
    r - o < s && (i(), s >= r) ? n.write(t) : (u.write(t, o, e), (o += s))
  }
}
function createInputAndOutput(t) {
  return {
    ...createInput({ stdin: t.stdin, encoding: t.encoding }),
    ...createOutput({
      stdout: t.stdout,
      encoding: t.encoding,
      outputBufferThreshold: t.outputBufferThreshold,
    }),
  }
}
async function __main__(t, n, e = {}) {
  const r = createInputAndOutput(e)
  await Promise.all([r.init(), Promise.resolve(n && n())]),
    await t(r),
    r.flush()
}
const MAX_N = 300010,
  sum = new Array(MAX_N)
__main__(
  function (t) {
    const n = t.readLineAsNumber()
    sum[0] = 0
    for (let e = 1; e <= n; ++e) {
      const [n, e] = t.readIntegersOfLine(),
        r = t.readLine()
      for (let t = 0; t < n; ++t) {
        const n = r[t],
          e = (t + 1) & 1 ? ('+' === n ? 1 : -1) : '+' === n ? -1 : 1
        sum[t + 1] = sum[t] + e
      }
      for (let n = 1; n <= e; ++n) {
        const [n, e] = t.readIntegersOfLine(),
          r = (e - n + 1) & 1 ? 1 : sum[e] === sum[n - 1] ? 0 : 2
        t.println(r)
      }
    }
  },
  void 0,
  { outputBufferThreshold: 1 << 26 },
)

'use strict'
var os = require('os')
const stdin = process.stdin,
  stdout = process.stdout,
  integerRegex = /-?\d+/g,
  decimalRegex = /-?\d+(?:\.\d+)?/g
class InputAndOutput {
  encoding
  outputBuffer
  outputBufferThreshold
  outputBufferSize
  lineIndex = 0
  lines = []
  constructor(t) {
    ;(this.outputBufferThreshold = t.outputBufferThreshold || 1 << 24),
      (this.outputBuffer = Buffer.alloc(this.outputBufferThreshold)),
      (this.encoding = t.encoding || 'ascii'),
      (this.outputBufferSize = 0)
  }
  flush() {
    const { encoding: t, outputBuffer: e, outputBufferSize: n } = this
    stdout.write(e.toString(t, 0, n)), (this.outputBufferSize = 0)
  }
  print(t) {
    const e = Buffer.byteLength(t, this.encoding)
    this.outputBufferThreshold - this.outputBufferSize < e &&
    (this.flush(), e >= this.outputBufferThreshold)
      ? stdout.write(t)
      : (this.outputBuffer.write(t, this.outputBufferSize, this.encoding),
        (this.outputBufferSize += e))
  }
  printNumber(t) {
    this.print(String(t))
  }
  println(t) {
    this.print(String(t).concat('\n'))
  }
  dried() {
    return this.lineIndex >= this.lines.length
  }
  readLine() {
    const t = this.lines[this.lineIndex]
    return (this.lineIndex += 1), t
  }
  readLineAsNumber() {
    return Number(this.readLine())
  }
  readIntegersOfLine() {
    const t = this.readLine().match(integerRegex)
    return null == t ? [] : t.map(t => Number(t))
  }
  readNumsOfLine() {
    const t = this.readLine().match(decimalRegex)
    return null == t ? [] : t.map(t => Number(t))
  }
  async init() {
    const t = await this.readLines()
    this.lines = t
  }
  readLines() {
    const t = []
    return new Promise(e => {
      stdin.on('data', e => t.push(e)),
        stdin.on('end', function () {
          const n = t.join('').split(os.EOL)
          e(n)
        })
    })
  }
}
async function __main__(t, e = {}) {
  const n = new InputAndOutput(e)
  await n.init(), await t(n), n.flush()
}
const MAX_N = 300010,
  sum = new Array(MAX_N)
__main__(function (t) {
  const e = t.readLineAsNumber()
  sum[0] = 0
  for (let n = 1; n <= e; ++n) {
    const [e, n] = t.readIntegersOfLine(),
      i = t.readLine()
    for (let t = 0; t < e; ++t) {
      const e = i[t],
        n = (t + 1) & 1 ? ('+' === e ? 1 : -1) : '+' === e ? -1 : 1
      sum[t + 1] = sum[t] + n
    }
    for (let e = 1; e <= n; ++e) {
      const [e, n] = t.readIntegersOfLine(),
        i = (n - e + 1) & 1 ? 1 : sum[n] === sum[e - 1] ? 0 : 2
      t.println(i)
    }
  }
})

'use strict'
var os = require('os')
const stdin = process.stdin,
  stdout = process.stdout,
  integerRegex = /-?\d+/g,
  decimalRegex = /-?\d+(?:\.\d+)?/g
class InputAndOutput {
  encoding
  outputBuffer
  outputBufferThreshold
  outputBufferSize
  lineIndex = 0
  lines = []
  constructor(t) {
    ;(this.outputBufferThreshold = t.outputBufferThreshold || 1 << 24),
      (this.outputBuffer = Buffer.alloc(this.outputBufferThreshold)),
      (this.encoding = t.encoding || 'ascii'),
      (this.outputBufferSize = 0)
  }
  flush() {
    const { encoding: t, outputBuffer: e, outputBufferSize: n } = this
    stdout.write(e.toString(t, 0, n)), (this.outputBufferSize = 0)
  }
  print(t) {
    const e = Buffer.byteLength(t, this.encoding)
    this.outputBufferThreshold - this.outputBufferSize < e &&
    (this.flush(), e >= this.outputBufferThreshold)
      ? stdout.write(t)
      : (this.outputBuffer.write(t, this.outputBufferSize, this.encoding),
        (this.outputBufferSize += e))
  }
  printNumber(t) {
    this.print(String(t))
  }
  println(t) {
    stdout.write(String(t).concat('\n'))
  }
  dried() {
    return this.lineIndex >= this.lines.length
  }
  readLine() {
    const t = this.lines[this.lineIndex]
    return (this.lineIndex += 1), t
  }
  readLineAsNumber() {
    return Number(this.readLine())
  }
  readIntegersOfLine() {
    const t = this.readLine().match(integerRegex)
    return null == t ? [] : t.map(t => Number(t))
  }
  readNumsOfLine() {
    const t = this.readLine().match(decimalRegex)
    return null == t ? [] : t.map(t => Number(t))
  }
  async init() {
    const t = await this.readLines()
    this.lines = t
  }
  readLines() {
    const t = []
    return new Promise(e => {
      stdin.on('data', e => t.push(e)),
        stdin.on('end', function () {
          const n = t.join('').split(os.EOL)
          e(n)
        })
    })
  }
}
async function __main__(t, e = {}) {
  const n = new InputAndOutput(e)
  await n.init(), await t(n), n.flush()
}
const MAX_N = 300010,
  sum = new Array(MAX_N)
__main__(function (t) {
  const e = t.readLineAsNumber()
  sum[0] = 0
  for (let n = 1; n <= e; ++n) {
    const [e, n] = t.readIntegersOfLine(),
      i = t.readLine()
    for (let t = 0; t < e; ++t) {
      const e = i[t],
        n = (t + 1) & 1 ? ('+' === e ? 1 : -1) : '+' === e ? -1 : 1
      sum[t + 1] = sum[t] + n
    }
    const s = []
    for (let e = 1; e <= n; ++e) {
      const [e, n] = t.readIntegersOfLine(),
        i = (n - e + 1) & 1 ? 1 : sum[n] === sum[e - 1] ? 0 : 2
      s.push(i)
    }
    t.println(s.join('\n'))
  }
})

'use strict'
var os = require('os')
const stdin = process.stdin,
  stdout = process.stdout,
  integerRegex = /-?\d+/g,
  decimalRegex = /-?\d+(?:\.\d+)?/g
class InputAndOutput {
  lineIndex = 0
  lines = []
  dried() {
    return this.lineIndex >= this.lines.length
  }
  readLine() {
    const n = this.lines[this.lineIndex]
    return (this.lineIndex += 1), n
  }
  readLineAsNumber() {
    return Number(this.readLine())
  }
  readIntegersOfLine() {
    const n = this.readLine().match(integerRegex)
    return null == n ? [] : n.map(n => Number(n))
  }
  readNumsOfLine() {
    const n = this.readLine().match(decimalRegex)
    return null == n ? [] : n.map(n => Number(n))
  }
  print(n) {
    stdout.write(String(n))
  }
  println(n) {
    stdout.write(String(n)), stdout.write('\n')
  }
  async init() {
    const n = await this.readLines()
    this.lines = n
  }
  readLines() {
    const n = []
    return new Promise(e => {
      stdin.on('data', e => n.push(e)),
        stdin.on('end', function () {
          const t = n.join('').split(os.EOL)
          e(t)
        })
    })
  }
}
async function __main__(n) {
  const e = new InputAndOutput()
  await e.init(), n(e)
}
const MAX_N = 300010,
  sum = new Array(MAX_N)
__main__(function (n) {
  const e = n.readLineAsNumber()
  sum[0] = 0
  for (let t = 1; t <= e; ++t) {
    const [e, t] = n.readIntegersOfLine(),
      s = n.readLine()
    for (let n = 0; n < e; ++n) {
      const e = s[n],
        t = (n + 1) & 1 ? ('+' === e ? 1 : -1) : '+' === e ? -1 : 1
      sum[n + 1] = sum[n] + t
    }
    const i = []
    for (let e = 1; e <= t; ++e) {
      const [e, t] = n.readIntegersOfLine(),
        s = (t - e + 1) & 1 ? 1 : sum[t] === sum[e - 1] ? 0 : 2
      i.push(s)
    }
    n.println(i.join('\n'))
  }
})


Not so long ago, Vlad came up with an interesting function: $$$f_a(x)=\left\lfloor\frac{x}{a}\right\rfloor + x \bmod a$$$, where $$$\left\lfloor\frac{x}{a}\right\rfloor$$$ is $$$\frac{x}{a}$$$, rounded down, $$$x \bmod a$$$ — the remainder of the integer division of $$$x$$$ by $$$a$$$.For example, with $$$a=3$$$ and $$$x=11$$$, the value $$$f_3(11) = \left\lfloor\frac{11}{3}\right\rfloor + 11 \bmod 3 = 3 + 2 = 5$$$.The number $$$a$$$ is fixed and known to Vlad. Help Vlad find the maximum value of $$$f_a(x)$$$ if $$$x$$$ can take any integer value from $$$l$$$ to $$$r$$$ inclusive ($$$l \le x \le r$$$).

The first line of input data contains an integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of input test cases. This is followed by $$$t$$$ lines, each of which contains three integers $$$l_i$$$, $$$r_i$$$ and $$$a_i$$$ ($$$1 \le l_i \le r_i \le 10^9, 1 \le a_i \le 10^9$$$) — the left and right boundaries of the segment and the fixed value of $$$a$$$.

For each test case, output one number on a separate line — the maximum value of the function on a given segment for a given $$$a$$$.

NoteIn the first sample:  $$$f_3(1) = \left\lfloor\frac{1}{3}\right\rfloor + 1 \bmod 3 = 0 + 1 = 1$$$,  $$$f_3(2) = \left\lfloor\frac{2}{3}\right\rfloor + 2 \bmod 3 = 0 + 2 = 2$$$,  $$$f_3(3) = \left\lfloor\frac{3}{3}\right\rfloor + 3 \bmod 3 = 1 + 0 = 1$$$,  $$$f_3(4) = \left\lfloor\frac{4}{3}\right\rfloor + 4 \bmod 3 = 1 + 1 = 2$$$ As an answer, obviously, $$$f_3(2)$$$ and $$$f_3(4)$$$ are suitable.

process.stdin.resume();
process.stdin.setEncoding('utf-8');
let inputString = '';
let currentLine = 0;
process.stdin.on('data', inputStdin => {
    inputString += inputStdin;
});
function readLine() {
    return inputString[currentLine++];
};
process.stdin.on('end', _ => {
    inputString = inputString.trim().split('\n').map(string => {
        return string.trim();
    });
    main();
    // cmd(not powershell): node cp.js < input.txt
});

function main() {
    let t = parseInt(readLine());
    while (t-- > 0) {
        solve();
    }
}
function solve() {
    let [l, r, a] = readLine().split(" ").map(i => BigInt(i));
    let ans = r / a + r % a;
    let m = r / a * a - 1n;
    if (m >= l) ans = Math.max(Number(ans), Number(m / a + m % a));
    console.log(Number(ans));
}

var m = function(a){
    return Math.floor(a);
};
let stop = '';
process.stdin.on('data', c => stop += c);
process.stdin.on('end', () => {
    const {EOL} = require('os');
    const lines = stop.split(EOL);
    var t = lines[0];
    var n = 0;
    for(i = 1; i <= t; i++){
        var k = lines[i].split(' ').map(Number);
        var l = k[0], r = k[1], a = k[2];
        var x = Math.floor((r + 1) / a) * a - 1;
        console.log(l <= x ? m(x / a) + m(x % a) : m(r / a) + m(r % a));
    }
});

'use strict'; /*jslint node:true, browser:true, es6:true*/
const print = console.log
const E = {};
const lines = []
if (!process.env.JEST_WORKER_ID){
  const rl = require('readline').createInterface({ input: process.stdin, output: process.stdout })
  rl.on('line', line => {
      lines.push(line);
  });
  rl.on('close', main)
}
let rli = 0;
function readline() {
    return lines[rli++];
}

module.exports = E;

const ra = ()=>readline().split(' ').map(a=>+a)

const EPS = 1e-6;

let f = (a, x)=>{
  return Math.floor(x/a) + (x%a);
};
const calc = (l, r, a)=>{
  let ans = f(a, l);
  ans = Math.max(ans, f(a, r));
  let R = r-r%a;
  if (R>=l && R<=r)
    ans = Math.max(ans, f(a, R));
  R--;
  if (R>=l && R<=r)
    ans = Math.max(ans, f(a, R));
  R-=2;
  if (R>=l && R<=r)
    ans = Math.max(ans, f(a, R));
  return ans;
};

function main() {
    let T = +readline()
    while (T--){
      let [l, r, a] = ra();
      print(calc(l, r, a));
    }
}

E.calc = calc;

const readline = require('readline')

const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
})
const lines = []
rl.on('line', (input) => {
    lines.push(input);
})
rl.on('close', () => {
// (function() {
    // const lines = require('fs').readFileSync('test.in', 'utf8').split('\n')
    let l = 0;
    let t = +lines[l++]
    const output = []
    for (let i = 0; i < t; i++) {
        const [left, right, a] = lines[l++].trim().split(' ').map(Number)
        output[i] = solve(left, right, a)
    }
    console.log(output.join('\n'))
// })()
})

function solve(left, right, a) {
    // for (let i = left; i <= right; i++) {
    //     console.log(i, cal(i, a))
    // }

    const r1 = left % a
    const k1 = Math.floor(left / a)
    const r2 = right % a
    const k2 = Math.floor(right / a)
    let ans = cal(right, a)
    if (right - r2 - 1 >= left) {
        ans = Math.max(ans, cal(right - r2 - 1, a))
    }
    return ans
console.log(k1, k2)
    if (k2 - k1 > 1) return a - 1

    if (k1 === k2) {
        const v1 = cal(left, a)
        const v2 = cal(right, a)
        return get(v1, v2, a)
    } else {
        // k1 + 1 = k2
        const v1 = cal(left, a)
        const v2 = cal(left - r1 + a, a)
        const v3 = cal(right - r2, a)
        const v4 = cal(right, a)
    console.log(v1, v2, v3, v4)
        return Math.max(get(v1, v2, a), get(v3, v4, a))
    }
}
function get(v1, v2, a) {
    return v1 <= v2 ? v2 : a - 1
}
function cal(x, a) {
    const f = Math.floor(x / a) + x % a
    return f
}

function solve() {
   const [l, r, a] = readArray(Number);
   const modR = r % a;
   if (modR === a - 1) {
      write(f(r, a));
      return;
   }
   const x = r - modR - 1;
   if (x < l) {
      write(f(r, a));
      return;
   }
   write(f(x, a));
}

function f(x, a) {
   return (Math.floor(x / a) + x % a);
}

function sortF(a, b) {
   if (a < b) {
      return -1;
   }
   if (a > b) {
      return 1;
   }
   return 0;
}

function pDivCount(n) {
   let ans = 0;
   let i = 1;
   while(n > 1) {
      i++;
      while(n % i === 0) {
         ans++;
         n = Math.floor(n / i);
      }
   }
   return ans;
}

function gcd(a, b) {
   if (a === 0) {
      return b;
   }
   return gcd(b % a, a);
}

function lcm(a, b) {
   return Math.floor(a / gcd(a, b)) * b;
}

function init() {
   try {
      var T;
      T = 1;
      T = Number(read());
      for (var t = 0; t < T; t++) {
         solve();
      }
   } catch (e) {
      write(e);
   }
}

function readArray(mapF) {
   var res = read().split(' ');
   if (mapF) {
      res = res.map(mapF);
   }
   return res;
}

var isNode = typeof console !== 'undefined';
var MEMORY = [];
var MEMORY_INDEX = 0;
if (isNode) {
   var fs = require('fs');

   var inTextName;
   var outTextName;
   if (process.argv.length === 5) {
      inTextName = process.argv[3];
      outTextName = process.argv[4];
   }
   MEMORY = fs.readFileSync(inTextName ? require('path').join(__dirname, inTextName) : 0, 'utf8').split('\r\n');
}
init();

function write(value) {
   isNode ? console.log('' + value) : print('' + value);
}
function read() {
   return isNode ? MEMORY[MEMORY_INDEX++] : readline();
}
function readAll() {
   if (isNode) {
      return MEMORY;
   }
   var res = [];
   var x;
   while (x = read()) {
      res.push(x);
   }
   return res;
}

var t = readline();

for (var i = 0; i < t; i++) {
  var k = readline().split(' ').map(Number);
  var l = k[0], r = k[1], a = k[2];
  var b = Math.floor(r / a) + r % a;
  var c = Math.floor(r / a) * a - 1;
  var d = Math.floor(c / a) + c % a;
  if (l <= c) b = Math.max(b, d);
  print(b);
}

process.stdin.resume();
process.stdin.setEncoding('utf-8');
let inputString = '';
let currentLine = 0;
process.stdin.on('data', inputStdin => {
    inputString += inputStdin;
});
function readLine() {
    return inputString[currentLine++];
};
process.stdin.on('end', _ => {
    inputString = inputString.trim().split('\n').map(string => {
        return string.trim();
    });
    main();
    // cmd(not powershell): node cp.js < input.txt
});

function main() {
    let t = parseInt(readLine());
    while (t-- > 0) {
        solve();
    }
}
function solve() {
    let [l, r, a] = readLine().split(" ").map(i => parseInt(i));
    let ans = parseInt(r / a) + r % a;
    let m = parseInt(r / a) * a - 1;
    if (m >= l) ans = Math.max(ans, parseInt(m / a) + m % a);
    console.log(ans);
}

process.stdin.resume();
process.stdin.setEncoding('utf-8');
let inputString = '';
let currentLine = 0;
process.stdin.on('data', inputStdin => {
    inputString += inputStdin;
});
function readLine() {
    return inputString[currentLine++];
};
process.stdin.on('end', _ => {
    inputString = inputString.trim().split('\n').map(string => {
        return string.trim();
    });
    main();
    // cmd(not powershell): node cp.js < input.txt
});

function main() {
    let t = parseInt(readLine());
    while (t-- > 0) {
        solve();
    }
}
function solve() {
    let [l, r, a] = readLine().split(" ").map(i => parseInt(i));
    let R = r;
    if (r % a == 0) r--;
    let q = parseInt(r / a);
    if (r < l) {
        console.log(parseInt(R / a) + R % a);
        return;
    }
    if (r % a < parseInt(a / 2)) {
        if ((q * a - 1) >= l && (q * a - 1) <= R) {
            r = q * a - 1;
            console.log(parseInt(r / a) + r % a);
            return;
        } else {
            console.log(parseInt(r / a) + r % a)
            return;
        }
    } else {
        console.log(parseInt(r / a) + r % a);
        return;
    }
}

var t = readline();

for (var i = 0; i < t; i++) {
  var a = readline().split(' ').map(Number);
  var b = Math.floor(a[1] / a[2]);
  var c = (Math.floor(a[1] / a[2]) - 1 + a[2] - 1);
  var r = Math.max(b + a[1] % a[2], c);
  if (a[0] <= a[2]) r * Math.floor(a[1] / a[2]) - 1;
  else r * Math.floor(a[1] / a[2]) + a[1] % a[2];
  print(r);
}