As their story unravels, a timeless tale is told once again...

Shirahime, a friend of Mocha's, is keen on playing the music game Arcaea and sharing Mocha interesting puzzles to solve. This day, Shirahime comes up with a new simple puzzle and wants Mocha to solve them. However, these puzzles are too easy for Mocha to solve, so she wants you to solve them and tell her the answers. The puzzles are described as follow.

There are $n$ squares arranged in a row, and each of them can be painted either red or blue.

Among these squares, some of them have been painted already, and the others are blank. You can decide which color to paint on each blank square.

Some pairs of adjacent squares may have the same color, which is imperfect. We define the imperfectness as the number of pairs of adjacent squares that share the same color.

For example, the imperfectness of "BRRRBBR" is $3$, with "BB" occurred once and "RR" occurred twice.

Your goal is to minimize the imperfectness and print out the colors of the squares after painting.


-----Input-----

Each test contains multiple test cases.

The first line contains a single integer $t$ ($1 \le t \le 100$) — the number of test cases. Each test case consists of two lines.

The first line of each test case contains an integer $n$ ($1\leq n\leq 100$) — the length of the squares row.

The second line of each test case contains a string $s$ with length $n$, containing characters 'B', 'R' and '?'. Here 'B' stands for a blue square, 'R' for a red square, and '?' for a blank square.


-----Output-----

For each test case, print a line with a string only containing 'B' and 'R', the colors of the squares after painting, which imperfectness is minimized. If there are multiple solutions, print any of them.


-----Examples-----

Input
5
7
?R???BR
7
???R???
1
?
1
B
10
?R??RB??B?
Output
BRRBRBR
BRBRBRB
B
B
BRRBRBBRBR


-----Note-----

In the first test case, if the squares are painted "BRRBRBR", the imperfectness is $1$ (since squares $2$ and $3$ have the same color), which is the minimum possible imperfectness.

Source: codeforces | Difficulty: EASY
Tags: Dynamic programming

Greedy algorithms


Solutions:
import sys
input = sys.stdin.readline

def main():
	n = int(input())
	S = list(input().strip())
	bef = ''
	rg = {'B': 'R', 'R': 'B'}
	for (i, s) in enumerate(S):
		if s == '?':
			if bef != '':
				S[i] = rg[bef]
				bef = rg[bef]
		else:
			bef = s
	if S[-1] == '?':
		S[-1] = 'B'
	bef = ''
	for i in range(n - 1, -1, -1):
		s = S[i]
		if s == '?':
			if bef != '':
				S[i] = rg[bef]
				bef = rg[bef]
		else:
			bef = s
	print(''.join(S))
for _ in range(int(input())):
	main()


t = int(input())
for _ in range(t):
	n = int(input())
	l = [c for c in input()]
	while '?' in l:
		for i in range(1, n - 1):
			if l[i] == 'B':
				if l[i - 1] == '?':
					l[i - 1] = 'R'
				if l[i + 1] == '?':
					l[i + 1] = 'R'
			if l[i] == 'R':
				if l[i - 1] == '?':
					l[i - 1] = 'B'
				if l[i + 1] == '?':
					l[i + 1] = 'B'
		if l[0] == 'R' and l[1] == '?':
			l[1] = 'B'
		elif l[0] == 'B' and l[1] == '?':
			l[1] = 'R'
		elif l[n - 1] == 'R' and l[n - 2] == '?':
			l[n - 2] = 'B'
		elif l[n - 1] == 'B' and l[n - 2] == '?':
			l[n - 2] = 'R'
		if not 'R' in l or not 'B' in l:
			l[0] = 'R'
	print(''.join(l))


T = int(input())
for _ in range(T):
	n = int(input())
	s = input()
	d = {'B': 'R', 'R': 'B', '?': 'B'}
	arr = []
	for (i, c) in enumerate(s):
		arr.append(c)
		if c != '?':
			j = i - 1
			while j >= 0 and s[j] == '?':
				arr[j] = d[arr[j + 1]]
				j -= 1
	for (i, c) in enumerate(arr):
		if c == '?':
			arr[i] = d[arr[i - 1]]
	print(''.join(arr))


def f(a):
	for i in range(len(a)):
		if a[i] == 'R' and i % 2 == 0:
			return 'R0'
		elif a[i] == 'R' and i % 2 == 1:
			return 'R1'
		elif a[i] == 'B' and i % 2 == 0:
			return 'B0'
		elif a[i] == 'B' and i % 2 == 1:
			return 'B1'
	return '???'
for _ in range(int(input())):
	n = int(input())
	a = input()
	o = ''
	if n == 1:
		prev = ''
	else:
		check = f(a)
		if check == 'R0':
			prev = 'B'
		elif check == 'R1':
			prev = 'R'
		elif check == 'B0':
			prev = 'R'
		elif check == 'B1':
			prev = 'B'
		else:
			prev = ''
	for x in a:
		if x == '?':
			if prev == 'R':
				o += 'B'
				prev = 'B'
			else:
				o += 'R'
				prev = 'R'
		else:
			o += x
			prev = x
	print(o)


import sys
input = lambda : sys.stdin.readline()
int_arr = lambda : list(map(int, input().split()))
str_arr = lambda : list(map(str, input().split()))
get_str = lambda : map(str, input().split())
get_int = lambda : map(int, input().split())
get_flo = lambda : map(float, input().split())
mod = 1000000007

def solve(n, s):
	ind = -1
	if s[0] != '?':
		ind = 0
	else:
		for i in range(n):
			if s[i] in ['R', 'B']:
				ind = i
				break
	d = {'R': 'B', 'B': 'R'}
	if ind == -1 or (n == 1 and s[0] == '?'):
		print(('BR' * n)[:n])
		return
	elif ind == 0:
		s = list(s)
		for i in range(1, n):
			if s[i] == '?':
				s[i] = d[s[i - 1]]
	elif ind > 0:
		s = list(s)
		for i in range(ind - 1, -1, -1):
			if s[i] == '?':
				s[i] = d[s[i + 1]]
		for i in range(ind, n):
			if s[i] == '?':
				s[i] = d[s[i - 1]]
	print(''.join(s))
for _ in range(int(input())):
	n = int(input())
	s = str(input())[:-1]
	solve(n, s)


for t in range(int(input())):
	n = int(input())
	s = str(input())
	new_list = list(s)
	count = 0
	flag = 0
	my_list = []
	for i in range(n):
		if flag == 0:
			if new_list[i] in ['R', 'B'] and count == 0:
				flag = 1
			elif new_list[i] == '?':
				count += 1
				if n == count:
					if count % 2 == 0:
						[my_list.append('RB') for x in range(count // 2)]
					else:
						[my_list.append('BR') for x in range((count - 1) // 2)]
						my_list.append('B')
			elif new_list[i] == 'R':
				if count % 2 == 0:
					[my_list.append('RB') for x in range(count // 2)]
					flag = 1
				else:
					[my_list.append('BR') for x in range((count - 1) // 2)]
					my_list.append('B')
					flag = 1
			elif new_list[i] == 'B':
				if count % 2 == 0:
					[my_list.append('BR') for x in range(count // 2)]
					flag = 1
				else:
					[my_list.append('RB') for x in range((count - 1) // 2)]
					my_list.append('R')
					flag = 1
		elif new_list[i] == '?':
			if new_list[i - 1] == 'R':
				new_list[i] = 'B'
			else:
				new_list[i] = 'R'
	if n == count:
		temp = ''.join(my_list)
		print(temp)
	else:
		temp1 = ''.join(my_list)
		temp2 = ''.join(new_list[count:])
		print(temp1 + temp2)


for _ in range(int(input())):
	n = int(input())
	s = list(input())
	if 'R' not in s and 'B' not in s:
		s[0] = 'R'
	for i in range(1, n):
		if s[i] == '?' and s[i - 1] != '?':
			s[i] = 'R' if s[i - 1] == 'B' else 'B'
	for i in range(n - 1, -1, -1):
		if s[i] == '?':
			s[i] = 'R' if s[i + 1] == 'B' else 'B'
	print(''.join(s))


import sys, math, io, os, time, itertools, collections
mod = 10 ** 9 + 7
sys.setrecursionlimit(10000)
i = sys.stdin.readline
p = sys.stdout.write
global start, end

def isin(l, x):
	left = 0
	right = len(l) - 1
	if x < l[0]:
		return -1
	while left <= right:
		mid = left + (right - left) // 2
		if l[mid] == x:
			return mid
		elif l[mid] < x:
			ans = mid
			left = mid + 1
		else:
			right = mid - 1
	return ans

def ispal(l):
	n = len(l)
	for i in range(n // 2 + 1):
		if l[i] != l[n - i - 1]:
			return False
	return True

def ccarray(l):
	d = {l[k]: k for k in range(len(l))}
	m = sorted(d)
	return [d[m[k]] for k in range(len(l))]

def is_prime(n):
	if n <= 3:
		return n > 1
	if n % 2 == 0 or n % 3 == 0:
		return False
	k = 5
	while k ** 2 <= n:
		if n % k == 0 or n % (k + 2) == 0:
			return False
		k += 6
	return True

def sieve(n):
	prime = [True for k in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for k in range(p * p, n + 1, p):
				prime[k] = False
		p += 1

def main():
	n = int(i())
	s = i().strip()
	stemp = ''
	seed = ''
	antiseed = ''
	for x in s:
		if x == 'R':
			stemp += '0'
		elif x == 'B':
			stemp += '1'
		else:
			stemp += '?'
	fin = ''
	bool = True
	for k in range(n):
		if stemp[k] == '?' and bool:
			if k & 1:
				fin += '1'
			else:
				fin += '0'
		if stemp[k] != '?' and bool:
			bool = False
			if len(fin) != 0:
				if stemp[k] == '0' and fin[-1] == '0':
					fin = fin[1:] + '1'
				elif stemp[k] == '1' and fin[-1] == '1':
					fin = fin[1:] + '0'
			fin += stemp[k]
			seed = stemp[k]
			if seed == '0':
				antiseed = '1'
			else:
				antiseed = '0'
		elif stemp[k] == '0' or stemp[k] == '1':
			fin += stemp[k]
			seed = stemp[k]
			if seed == '0':
				antiseed = '1'
			else:
				antiseed = '0'
		elif stemp[k] == '?' and (not bool):
			fin += antiseed
			seed = antiseed
			if seed == '0':
				antiseed = '1'
			else:
				antiseed = '0'
	final = ''
	for x in fin:
		if x == '1':
			final += 'B'
		elif x == '0':
			final += 'R'
		else:
			final += '?'
	p(final + '\n')
t = 1
t = int(i())
start = time.perf_counter()
for _ in range(t):
	main()
end = time.perf_counter()


t = int(input())
hm = {'R': 'B', 'B': 'R'}
for i in range(t):
	n = int(input())
	values = list(input())
	pos = []
	last = None
	for i in range(n):
		if values[i] == 'R' or values[i] == 'B':
			last = i
			j = i - 1
			color = hm[values[i]]
			while j >= 0 and (values[j] != 'R' and values[j] != 'B'):
				values[j] = color
				color = hm[values[j]]
				j -= 1
	if last is None:
		color = 'B'
		for i in range(n):
			values[i] = color
			color = hm[values[i]]
	elif last < n - 1:
		color = hm[values[last]]
		for i in range(last + 1, n):
			values[i] = color
			color = hm[values[i]]
	print(''.join(values))


from __future__ import division, print_function
import os
import sys
from io import BytesIO, IOBase
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip

def main():
	for _ in range(int(input())):
		n = int(input())
		a = list(input())
		if a.count('?') == n:
			ans = []
			for i in range(n):
				if i % 2 == 0:
					ans.append('R')
				else:
					ans.append('B')
			print(''.join(ans))
			continue
		for i in range(n):
			if i - 1 >= 0 and a[i] != '?' and (a[i - 1] == '?'):
				j = i - 1
				while j >= 0 and a[j] == '?':
					if a[j + 1] == 'B':
						a[j] = 'R'
					else:
						a[j] = 'B'
					j -= 1
			if i + 1 < n and a[i] != '?' and (a[i + 1] == '?'):
				j = i + 1
				while j < n and a[j] == '?':
					if a[j - 1] == 'B':
						a[j] = 'R'
					else:
						a[j] = 'B'
					j += 1
		print(''.join(a))
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


import math
t = int(input())
for _ in range(t):
	n = int(input())
	s = list(input())
	color = 'B'
	count = 0
	if s.count('?') == 0:
		print(''.join(s))
		continue
	for i in range(n):
		if s[i] == '?':
			count += 1
		elif s[i] == 'B' and count:
			color = 'R'
			for j in range(i - 1, i - count - 1, -1):
				s[j] = color
				if color == 'R':
					color = 'B'
				else:
					color = 'R'
			count = 0
		elif s[i] == 'R' and count:
			color = 'B'
			for j in range(i - 1, i - count - 1, -1):
				s[j] = color
				if color == 'R':
					color = 'B'
				else:
					color = 'R'
			count = 0
		if i == n - 1 and count:
			if s[i - count] == 'B':
				color = 'R'
			else:
				color = 'B'
			for j in range(i - count + 1, i + 1):
				s[j] = color
				if color == 'R':
					color = 'B'
				else:
					color = 'R'
			count = 0
	print(''.join(s))


import sys
from math import factorial, gcd
from collections import Counter, deque, defaultdict
from bisect import bisect_left, bisect_right
from heapq import heappop, heappush, heapify, nlargest, nsmallest
from itertools import groupby
from copy import deepcopy
MOD = 1000000007
INF = float('inf')
rl = lambda : list(map(int, sys.stdin.readline().split()))
rs = lambda : sys.stdin.readline().strip()

def count(arr):
	res = 0
	for i in range(1, n):
		if arr[i - 1] == arr[i]:
			res += 1
	return res
for _ in range(int(input())):
	n = int(input())
	s = list(rs())
	t = s[:]
	for i in range(n):
		if i == 0 and s[i] == '?':
			if i + 1 < n and s[i + 1] == 'B':
				s[i] = 'R'
			elif i + 1 < n and s[i + 1] == 'R':
				s[i] = 'B'
			else:
				s[i] = 'B'
		elif s[i] == '?':
			if s[i - 1] == 'B':
				s[i] = 'R'
			else:
				s[i] = 'B'
	for i in range(n):
		if i == 0 and t[i] == '?':
			if i + 1 < n and t[i + 1] == 'B':
				t[i] = 'R'
			elif i + 1 < n and t[i + 1] == 'R':
				t[i] = 'B'
			else:
				t[i] = 'R'
		elif t[i] == '?':
			if t[i - 1] == 'B':
				t[i] = 'R'
			else:
				t[i] = 'B'
	print(''.join(s)) if count(s) <= count(t) else print(''.join(t))


def fucn(lst, n):
	for i in range(n):
		if lst[i] == 'R':
			if i > 0 and lst[i - 1] == '?':
				lst[i - 1] = 'B'
			if i < n - 1 and lst[i + 1] == '?':
				lst[i + 1] = 'B'
		if lst[i] == 'B':
			if i > 0 and lst[i - 1] == '?':
				lst[i - 1] = 'R'
			if i < n - 1 and lst[i + 1] == '?':
				lst[i + 1] = 'R'
	return lst
t = int(input())
for k in range(t):
	n = int(input())
	lst = list(input())
	if 'R' not in lst and 'B' not in lst:
		for i in range(n):
			if i % 2 == 0:
				print('B', end='')
			else:
				print('R', end='')
		print()
	else:
		while '?' in lst:
			lst = fucn(lst, n)
		for i in range(n):
			print(lst[i], end='')
		print()


t = int(input())
for _ in range(t):
	n = int(input())
	s = input()
	st = []
	for ss in s:
		st.append(ss)
	al = True
	for ss in st:
		if ss != '?':
			al = False
	if al:
		st[0] = 'R'
	for i in range(1, len(s)):
		if st[i] == '?':
			if st[i - 1] == 'R':
				st[i] = 'B'
			elif st[i - 1] == 'B':
				st[i] = 'R'
	for i in range(len(s) - 2, -1, -1):
		if st[i] == '?':
			if st[i + 1] == 'R':
				st[i] = 'B'
			elif st[i + 1] == 'B':
				st[i] = 'R'
	ans = ''
	for ss in st:
		ans += ss
	print(ans)


import sys
sysinput = sys.stdin.readline
sysinput = input

def readint():
	return int(sysinput())

def readlst():
	return list(map(int, sysinput().split()))

def readchlst():
	s = sysinput()
	lst = list(s[:])
	try:
		lst.remove('\n')
	finally:
		return lst

def readintlst():
	return list(map(int, sysinput().split()))

def imperfectness(lst):
	cnt = 0
	for i in range(len(lst) - 1):
		if '?' != lst[i] == lst[i + 1] != '?':
			cnt += 1
	return cnt

def genBR(n, start):
	if start == 'R':
		output = BRlst[1:n + 1]
	elif start == 'B':
		output = BRlst[:n]
	return output
t = readint()
BRlst = ['B', 'R'] * 51
for case in range(t):
	n = readint()
	s = readchlst()
	filled_bool = [not i == '?' for i in s]
	if sum(filled_bool) == n:
		pass
	elif sum(filled_bool) == 0:
		s = genBR(n, 'B')
	else:
		while sum(filled_bool) != n:
			Fpos = filled_bool.index(False)
			try:
				Tpos = filled_bool.index(True, Fpos)
			except:
				Tpos = n
			s[Fpos:Tpos] = genBR(Tpos - Fpos, 'B')
			Bfirst_imperf = imperfectness(s)
			s[Fpos:Tpos] = genBR(Tpos - Fpos, 'R')
			Rfirst_imperf = imperfectness(s)
			filled_bool[Fpos:Tpos] = [True] * (Tpos - Fpos)
			if Rfirst_imperf > Bfirst_imperf:
				s[Fpos:Tpos] = genBR(Tpos - Fpos, 'B')
	sys.stdout.write(''.join(s) + '\n')


for i in range(int(input())):
	n = int(input())
	st = input()
	if len(st) == 1 and st == '?':
		st = ['B']
	flag = 0
	for i in st:
		if i == 'B' or i == 'R':
			flag = 1
			break
	if flag == 0:
		st = 'BR' * (n // 2)
		if n % 2 == 1:
			st += 'B'
	s = list(st)
	i = 0
	while i < n:
		if s[i] == 'B':
			if i - 1 > -1 and s[i - 1] == '?':
				s[i - 1] = 'R'
			if i + 1 < n and s[i + 1] == '?':
				s[i + 1] = 'R'
				i += 2
			else:
				i += 1
		elif s[i] == 'R':
			if i - 1 > -1 and s[i - 1] == '?':
				s[i - 1] = 'B'
			if i + 1 < n and s[i + 1] == '?':
				s[i + 1] = 'B'
				i += 2
			else:
				i += 1
		else:
			i += 1
	while True:
		i = 0
		flag = 0
		for j in s:
			if j == '?':
				flag = 1
				break
		if flag == 0:
			break
		while i < n:
			if s[i] == 'B':
				if i - 1 > -1 and s[i - 1] == '?':
					s[i - 1] = 'R'
				if i + 1 < n and s[i + 1] == '?':
					s[i + 1] = 'R'
			elif s[i] == 'R':
				if i - 1 > -1 and s[i - 1] == '?':
					s[i - 1] = 'B'
				if i + 1 < n and s[i + 1] == '?':
					s[i + 1] = 'B'
			i += 1
	print(''.join(s))


t = int(input())
for i in range(t):
	n = int(input())
	s = input()
	(s1, c) = ('', 0)
	a = 'B'
	for j in range(len(s)):
		if s[j] != '?':
			c = j
			a = s[j]
			break
	if a == 'R':
		if c % 2 != 0:
			a = 'B'
	elif c % 2 != 0:
		a = 'R'
	for j in s:
		if len(s1) != 0:
			if s1[-1] == 'R':
				a = 'B'
			else:
				a = 'R'
		if j != '?':
			s1 = s1 + j
		else:
			s1 = s1 + a
	print(s1)


import sys
INP = lambda : sys.stdin.readline().strip()
INT = lambda : int(INP())
MAP = lambda : map(int, INP().split())
ARR = lambda : list(INP())

def JOIN(arr, x=''):
	return x.join(arr)

def EXIT(x='NO'):
	print(x)
	exit()
for _ in range(INT()):
	(n, s) = (INT(), ARR())
	q = '?'
	(p, c) = ('?', 0)
	i = 0
	while i < n:
		if s[i] != q:
			p = s[i]
			break
		i += 1
	for j in range(i + 1, n):
		if s[j] == s[j - 1]:
			c += 1
		if s[j] == '?':
			s[j] = 'R' if s[j - 1] == 'B' else 'B'
	if i == n:
		s[-1] = 'B'
		i -= 1
	while i > 0:
		s[i - 1] = 'R' if s[i] == 'B' else 'B'
		i -= 1
	print(JOIN(s))


import sys, copy
input = sys.stdin.readline

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())

def rev(a):
	if a == 'R':
		return 'B'
	else:
		return 'R'
t = inp()
for _ in range(t):
	s = inp()
	l = insr()
	if l[0] != '?':
		ans = [l[0]]
	else:
		x = 0
		for i in range(len(l)):
			if l[i] != '?':
				j = l[i]
				break
			if i == len(l) - 1:
				j = 'R'
			x += 1
		if x % 2 == 0:
			ans = [j]
		else:
			ans = [rev(j)]
	for i in range(1, s):
		if l[i] == '?':
			ans.append(rev(ans[-1]))
		else:
			ans.append(l[i])
	print(*ans, sep='')


for _ in range(int(input())):
	n = int(input())
	s = list(input())
	x = ['?'] * n
	if x == s:
		ans = ''
		for i in range(n):
			if i % 2 == 0:
				ans += 'B'
			else:
				ans += 'R'
		print(ans)
	else:
		cnt = 0
		for i in range(n):
			if (s[i] == 'R' or s[i] == 'B') and cnt > 0:
				ind = i - 1
				while cnt > 0:
					if s[ind] == '?':
						if s[ind + 1] == 'R':
							s[ind] = 'B'
						else:
							s[ind] = 'R'
						cnt -= 1
					ind -= 1
			elif s[i] == '?':
				cnt += 1
		if cnt > 0:
			ind = -1
			for i in range(n - 1, -1, -1):
				if s[i] != '?':
					ind = i
					break
			for i in range(ind, n):
				if s[i] == '?':
					if s[i - 1] == 'R':
						s[i] = 'B'
					else:
						s[i] = 'R'
		ans = ''
		for i in s:
			ans += i
		print(ans)


import sys, random, bisect
from collections import deque, defaultdict
from heapq import heapify, heappop, heappush
from itertools import permutations
from math import gcd, log
mod = int(1000000000.0 + 7)
inf = int(1e+20)
input = lambda : sys.stdin.readline().rstrip()
mi = lambda : map(int, input().split())
li = lambda : list(mi())

def check(s):
	cnt = 0
	s = list(s)
	n = len(s)
	for i in range(1, n):
		if s[i] == '?':
			s[i] = 'B' if s[i - 1] == 'R' else 'R'
		elif s[i] == s[i - 1]:
			cnt += 1
	return (''.join(s), cnt)
t = int(input())
for _ in range(t):
	n = int(input())
	s = input()
	if s[0] == '?':
		(r1, c1) = check('B' + s[1:])
		(r2, c2) = check('R' + s[1:])
		print(r1 if c1 < c2 else r2)
	else:
		(r, c) = check(s)
		print(r)


t = int(input())
for _ in range(t):
	n = int(input())
	s = input()
	ans = ''
	i = 0
	cnt = 0
	last = None
	while i < len(s):
		if s[i] == '?':
			cnt += 1
		else:
			if last == None:
				if cnt % 2 == 0:
					if s[i] == 'B':
						ans += 'BR' * (cnt // 2)
					else:
						ans += 'RB' * (cnt // 2)
				elif s[i] == 'B':
					ans += 'RB' * (cnt // 2) + 'R'
				else:
					ans += 'BR' * (cnt // 2) + 'B'
			elif last == s[i]:
				if cnt % 2 == 0:
					ans += last + 'RB' * (cnt // 2)
				elif last == 'B':
					ans += last + 'RB' * (cnt // 2) + 'R'
				else:
					ans += last + 'BR' * (cnt // 2) + 'B'
			elif cnt % 2 == 0:
				if last == 'B':
					ans += last + 'RB' * (cnt // 2)
				else:
					ans += last + 'BR' * (cnt // 2)
			else:
				ans += last + 'RB' * (cnt // 2) + 'R'
			last = s[i]
			cnt = 0
		i += 1
	if cnt == 0 and last != None:
		ans += last
	if cnt != 0 and last != None:
		if last == 'R':
			if cnt % 2 == 0:
				ans += last + 'BR' * (cnt // 2)
			else:
				ans += last + 'BR' * (cnt // 2) + 'B'
		elif cnt % 2 == 0:
			ans += last + 'RB' * (cnt // 2)
		else:
			ans += last + 'RB' * (cnt // 2) + 'R'
	if last == None:
		if cnt % 2 == 0:
			ans = 'RB' * (cnt // 2)
		else:
			ans += 'RB' * (cnt // 2) + 'R'
	print(ans)


from collections import Counter
from sys import stdin, stdout
import math
from collections import defaultdict
for _ in range(int(stdin.readline())):
	n = int(stdin.readline())
	x = list(input())
	a = set(x)
	if len(a) == 1 and x[0] == '?':
		prev = 'B'
		for i in range(n):
			if prev == 'B' and x[i] == '?':
				x[i] = 'R'
			elif prev == 'R' and x[i] == '?':
				x[i] = 'B'
			prev = x[i]
		print(''.join(x))
	else:
		prev = ''
		for i in range(n):
			if prev == 'B' and x[i] == '?':
				x[i] = 'R'
			elif prev == 'R' and x[i] == '?':
				x[i] = 'B'
			prev = x[i]
		x = list(reversed(x))
		prev = ''
		for i in range(n):
			if prev == 'B' and x[i] == '?':
				x[i] = 'R'
			elif prev == 'R' and x[i] == '?':
				x[i] = 'B'
			prev = x[i]
		x = list(reversed(x))
		print(''.join(x))


t = int(input())
nums = []
nums1 = []
for i in range(t):
	n = int(input())
	nums1.append(n)
	a = input()
	nums.append(a)
for (k, r) in enumerate(nums):
	if '?' not in r:
		print(r)
		continue
	if r.count('?') == nums1[k]:
		b = 'R'
		for d in range(nums1[k]):
			print(b, end='')
			if b == 'R':
				b = 'B'
			else:
				b = 'R'
		print()
		continue
	e = None
	for (w, b) in enumerate(r):
		if b != '?':
			e = w
			break
	if e != nums1[k] - 1:
		for q in range(e, nums1[k]):
			if r[q] == '?':
				if r[q - 1] == 'B':
					r = r[:q] + 'R' + r[q + 1:]
				else:
					r = r[:q] + 'B' + r[q + 1:]
	if r[0] == '?':
		for y in range(e, 0, -1):
			if r[y] == 'B':
				r = r[:y - 1] + 'R' + r[y:]
			else:
				r = r[:y - 1] + 'B' + r[y:]
	print(r)


for _ in range(int(input())):
	n = int(input())
	s = input()
	if s[0] == '?' and n > 1:
		if 'R' in s and 'B' in s:
			if s.index('R') < s.index('B'):
				if s.index('R') % 2:
					s = 'B' + s[1:]
				else:
					s = 'R' + s[1:]
			elif s.index('B') % 2:
				s = 'R' + s[1:]
			else:
				s = 'B' + s[1:]
		elif 'R' in s and (not 'B' in s):
			if s.index('R') % 2:
				s = 'B' + s[1:]
			else:
				s = 'R' + s[1:]
		elif not 'R' in s and 'B' in s:
			if s.index('B') % 2:
				s = 'R' + s[1:]
			else:
				s = 'B' + s[1:]
		else:
			s = 'R' + s[1:]
	for i in range(1, n - 1):
		if s[i] == '?':
			if s[i - 1] == 'B':
				s = s[:i] + 'R' + s[i + 1:]
			else:
				s = s[:i] + 'B' + s[i + 1:]
	if s[-1] == '?' and n > 1:
		if s[-2] == 'B':
			s = s[:-1] + 'R'
		else:
			s = s[:-1] + 'B'
	if s[-1] == '?' and n == 1:
		s = 'B'
	print(s)


import sys
import os.path
from collections import *
import math
import bisect
import heapq as hq
from fractions import Fraction
from random import randint
if os.path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')

def solve():
	n = int(input())
	s = list(input())
	idx = n
	for i in range(n):
		if s[i] == 'R' or s[i] == 'B':
			idx = i
			break
	for i in range(idx, n):
		if s[i] == '?':
			if s[i - 1] == 'R':
				s[i] = 'B'
			else:
				s[i] = 'R'
	for i in range(idx - 1, -1, -1):
		if i + 1 == n:
			s[i] = 'R'
			continue
		if s[i + 1] == 'R':
			s[i] = 'B'
		else:
			s[i] = 'R'
	print(''.join(s))
t = int(input())
while t:
	t -= 1
	solve()


for i in range(int(input())):
	n = int(input())
	s = input()
	if s[0] == '?':
		a = s.find('R')
		b = s.find('B')
		s = list(s)
		if a == -1:
			a = 101
		if b == -1:
			b = 101
		if a == 101 and b == 101:
			s[0] = 'R'
		elif a < b:
			s[0] = ['R', 'B'][a % 2]
		else:
			s[0] = ['B', 'R'][b % 2]
	s = [*s]
	for i in range(1, n):
		if s[i] == '?':
			s[i] = ['R', 'B'][s[i - 1] == 'R']
	print(''.join(s))


import re
f = re.sub
for s in [*open(0)][2::2]:
	if {*s} == {*'?\n'}:
		s = 'R' + s[1:]
	while '?' in s:
		s = f('B\\?|\\?R', 'BR', f('R\\?|\\?B', 'RB', s))
	print(s)


def fit_blank(left, right, length):
	if left == 'C' and right == 'C':
		if length % 2 == 0:
			(left, right) = ('B', 'R')
		else:
			(left, right) = ('B', 'B')
	elif left == 'C':
		if length % 2 == 0:
			left = 'R' if right == 'B' else 'B'
		else:
			left = 'B' if right == 'B' else 'R'
	elif right == 'C':
		if length % 2 == 0:
			right = 'R' if left == 'B' else 'B'
		else:
			right = 'B' if left == 'B' else 'R'
	if length % 2 == 0:
		c = 'R' if left == 'B' else 'B'
		return [c, left] * (length // 2)
	else:
		c = 'R' if left == 'B' else 'B'
		return [c, left] * (length // 2) + [c]
T = int(input())
for _ in range(T):
	n = int(input())
	seq = list(input().strip())
	seq.append(' ')
	inblank = False
	for i in range(n):
		if seq[i] == '?' and (not inblank):
			inblank = True
			li = i
			lx = seq[i - 1] if i > 0 else 'C'
		elif seq[i] != '?' and inblank:
			inblank = False
			ri = i
			rx = seq[i]
			seq[li:ri] = fit_blank(lx, rx, ri - li)
	if inblank:
		ri = n
		rx = 'C'
		seq[li:ri] = fit_blank(lx, rx, ri - li)
	for char in seq:
		print(char, end='')
	print()


for _ in range(int(input())):
	n = int(input())
	s = list(input())
	i = 0
	if n == 1 and s[i] == '?':
		s[0] = 'B'
	if s.count('?') == n:
		s[0] = 'B'
	while i < n:
		if s[i] == '?':
			if i > 0 and s[i - 1] != '?':
				s[i] = 'B' if s[i - 1] == 'R' else 'R'
			else:
				j = i
				while j < n and s[j] == '?':
					j += 1
				x = j - 1
				while x >= i:
					s[x] = 'B' if s[x + 1] == 'R' else 'R'
					x -= 1
				i = j
				continue
		i += 1
	print(''.join(s))


t = int(input())
for _ in range(t):
	n = int(input())
	arr = list(input())
	if arr.count('?') == n:
		print(('RB' * n)[:n])
		continue
	prev = '?'
	for i in range(n):
		if arr[i] == '?' and prev != '?':
			if prev == 'R':
				arr[i] = 'B'
			else:
				arr[i] = 'R'
		prev = arr[i]
	prev = '?'
	for i in range(n - 1, -1, -1):
		if arr[i] == '?' and prev != '?':
			if prev == 'R':
				arr[i] = 'B'
			else:
				arr[i] = 'R'
		prev = arr[i]
	print(''.join(arr))


from sys import stdin
t = int(stdin.readline())
for _ in range(t):
	n = int(stdin.readline())
	s = list(stdin.readline()[:-1])
	if s.count('?') == n:
		val = 'BR' * n
		print(val[:n])
		continue
	if n == 1 and s[0] == '?':
		print('B')
		continue
	for i in range(1, n):
		if s[i] == '?':
			continue
		j = i - 1
		while j >= 0:
			if s[j] == '?' and s[j + 1] == 'R':
				s[j] = 'B'
			elif s[j] == '?' and s[j + 1] == 'B':
				s[j] = 'R'
			j -= 1
	j = 1
	while j < n:
		if s[j] == '?' and s[j - 1] == 'R':
			s[j] = 'B'
		elif s[j] == '?' and s[j - 1] == 'B':
			s[j] = 'R'
		j += 1
	print(''.join(s))


import os, sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
from math import ceil
mod = 10 ** 9 + 7
for _ in range(int(input())):
	n = int(input())
	s = input()
	if 'R' not in s and 'B' not in s:
		(a, value) = ('', 'R')
		for i in range(n):
			a += value
			if value == 'R':
				value = 'B'
			else:
				value = 'R'
		print(a)
	else:
		s = list(s)
		for i in range(n):
			if s[i] != '?':
				start = i
				break
		value = ''
		for i in range(start + 1, n):
			if s[i] == '?' and s[i - 1] == 'R':
				s[i] = 'B'
			elif s[i] == '?' and s[i - 1] == 'B':
				s[i] = 'R'
			else:
				continue
		for i in range(start - 1, -1, -1):
			if s[i] == '?' and s[i + 1] == 'R':
				s[i] = 'B'
			elif s[i] == '?' and s[i + 1] == 'B':
				s[i] = 'R'
			else:
				continue
		print(''.join(s))


t = int(input())
for i in range(t):
	n = int(input())
	s = input()
	sl = list(s)
	if n > 1:
		for x in range(n):
			if sl[x] == '?':
				if x == 0:
					stuf = 1
					while sl[stuf] == '?' and stuf < n - 1:
						stuf += 1
					if sl[stuf] == 'B':
						if stuf % 2 == 1:
							sl[0] = 'R'
						else:
							sl[0] = 'B'
					elif stuf % 2 == 1:
						sl[0] = 'B'
					else:
						sl[0] = 'R'
				elif sl[x - 1] == 'B':
					sl[x] = 'R'
				else:
					sl[x] = 'B'
		print(''.join(sl))
	elif s == '?':
		print('B')
	else:
		print(s)


import sys
input = sys.stdin.readline
for _ in range(int(input().strip())):
	n = int(input().strip())
	s = list(input().strip())
	p = ''
	b = 0
	for i in s:
		b += 1
		if i != '?':
			if i == 'B':
				if b % 2:
					p = 'R'
				else:
					p = 'B'
			elif b % 2:
				p = 'B'
			else:
				p = 'R'
			break
	if not p:
		p = 'B'
	for i in range(n):
		if s[i] == '?':
			if p == 'B':
				s[i] = 'R'
			else:
				s[i] = 'B'
		p = s[i]
	print(''.join(s))


def solve():
	n = int(input())
	s = list(input())
	ax = -1
	for i in range(n):
		if s[i] != '?':
			ax = i
			break
	if ax == -1:
		ans = 'RB' * (n // 2) + 'R' * (n % 2)
		print(ans)
	else:
		for i in range(ax + 1, n):
			if s[i] == '?' and s[i - 1] == 'B':
				s[i] = 'R'
			if s[i] == '?' and s[i - 1] == 'R':
				s[i] = 'B'
		for i in range(ax - 1, -1, -1):
			if s[i] == '?' and s[i + 1] == 'B':
				s[i] = 'R'
			if s[i] == '?' and s[i + 1] == 'R':
				s[i] = 'B'
		print(''.join(s))
t = int(input())
for _ in range(t):
	solve()


import sys
testcases = int(input())
while testcases > 0:
	n = int(input())
	a = list(map(str, sys.stdin.readline()))
	if not ('R' in a or 'B' in a):
		a[0] = 'R'
	for i in range(1, n):
		if a[i] == '?' and a[i - 1] == 'R':
			a[i] = 'B'
		elif a[i] == '?' and a[i - 1] == 'B':
			a[i] = 'R'
	for j in range(n - 1, -1, -1):
		if a[j] == '?' and a[j + 1] == 'R':
			a[j] = 'B'
		elif a[j] == '?' and a[j + 1] == 'B':
			a[j] = 'R'
	print(''.join(a), end='')
	testcases -= 1


for i in range(int(input())):
	n = int(input())
	s = input()
	while '?' in s:
		if s == '?' * n:
			s = 'BR' * n
			s = s[:n]
		s = s.replace('?B', 'RB')
		s = s.replace('?R', 'BR')
		s = s.replace('B?', 'BR')
		s = s.replace('R?', 'RB')
	print(s)


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	n = int(input())
	s = list(input().rstrip())
	ans = ''
	if 'R' not in s and 'B' not in s:
		for i in range(n):
			if i % 2 == 0:
				ans += 'R'
			else:
				ans += 'B'
		print(ans)
		continue
	cnt = 0
	temp = ''
	for i in range(n):
		if s[i] in ['R', 'B']:
			c = s[i]
			if c == 'R':
				for j in range(cnt):
					if j % 2 == 0:
						temp += 'B'
					else:
						temp += 'R'
			else:
				for j in range(cnt):
					if j % 2 == 0:
						temp += 'R'
					else:
						temp += 'B'
			cnt = 0
			ans += temp[::-1]
			ans += c
			temp = ''
		else:
			cnt += 1
	if cnt:
		if c == 'R':
			for j in range(cnt):
				if j % 2 == 0:
					ans += 'B'
				else:
					ans += 'R'
		else:
			for j in range(cnt):
				if j % 2 == 0:
					ans += 'R'
				else:
					ans += 'B'
	print(ans)


for _ in range(int(input())):
	n = int(input())
	ls = list(input().strip())
	for i in range(1, n):
		if ls[i] == '?' and ls[i - 1] != '?':
			ls[i] = 'B' if ls[i - 1] == 'R' else 'R'
	if ls[n - 1] == '?':
		for i in range(n):
			if i & 1:
				ls[i] = 'B'
			else:
				ls[i] = 'R'
	else:
		for i in range(n - 2, -1, -1):
			if ls[i] == '?' and ls[i + 1] != '?':
				ls[i] = 'B' if ls[i + 1] == 'R' else 'R'
	print(''.join(list(map(str, ls))))


t = int(input())
answer = ''
for _ in range(t):
	n = int(input())
	s = list(input())
	if 'R' in s and 'B' in s:
		start = min(s.index('R'), s.index('B'))
	elif 'R' in s and 'B' not in s:
		start = s.index('R')
	elif 'R' not in s and 'B' in s:
		start = s.index('B')
	elif 'R' not in s and 'B' not in s:
		start = 0
		s[0] = 'R'
	if start < n:
		for i in range(start, n - 1):
			if s[i] == 'R' and s[i + 1] == '?':
				s[i + 1] = 'B'
			elif s[i] == 'B' and s[i + 1] == '?':
				s[i + 1] = 'R'
	if start > 0:
		for j in range(0, start):
			if s[start - j] == 'R' and s[start - j - 1] == '?':
				s[start - j - 1] = 'B'
			elif s[start - j] == 'B' and s[start - j - 1] == '?':
				s[start - j - 1] = 'R'
	answer += ''.join(s) + '\n'
print(answer)


for _ in range(int(input())):
	n = int(input())
	s = input()
	ar = list(s)
	ar.reverse()
	b = ar.copy()
	k = 'R'
	h = 0
	for i in range(n):
		if ar[i] == '?':
			if k == 'B':
				ar[i] = 'R'
				k = 'R'
			else:
				ar[i] = 'B'
				k = 'B'
		elif k == ar[i] and i != 0:
			h = h + 1
		else:
			k = ar[i]
	p = 'B'
	y = 0
	for i in range(n):
		if b[i] == '?':
			if p == 'B':
				b[i] = 'R'
				p = 'R'
			else:
				b[i] = 'B'
				p = 'B'
		elif p == b[i] and i != 0:
			y = y + 1
		else:
			p = b[i]
	ar.reverse()
	b.reverse()
	if h < y:
		print(''.join(ar))
	else:
		print(''.join(b))


t = int(input())
for _ in range(t):
	n = int(input())
	a = input()
	while '?' in a:
		if a == '?' * len(a):
			a = 'BR' * len(a)
			a = a[:len(a) // 2]
		a = a.replace('?R', 'BR')
		a = a.replace('R?', 'RB')
		a = a.replace('B?', 'BR')
		a = a.replace('?B', 'RB')
	print(a)


for _ in range(int(input())):
	n = int(input())
	nstr = input()
	c = 0
	pstr = ''
	vstr = ''
	for i in range(len(nstr)):
		if i == 0 and nstr[i] == '?':
			pstr += 'R'
			vstr += 'B'
		elif nstr[i] == '?':
			if pstr[-1] == 'R':
				pstr += 'B'
			else:
				pstr += 'R'
			if vstr[-1] == 'R':
				vstr += 'B'
			else:
				vstr += 'R'
		else:
			pstr += nstr[i]
			vstr += nstr[i]
	v = p = 0
	for i in range(len(vstr) - 1):
		if vstr[i] == vstr[i + 1]:
			v += 1
		if pstr[i] == pstr[i + 1]:
			p += 1
	if v < p:
		print(vstr)
	else:
		print(pstr)


import math
import collections
import bisect
import functools
import sys

def fun(arr, i, d):
	if i < 0 or i >= len(arr) or arr[i] != '?':
		return
	if arr[i - d] == 'R':
		arr[i] = 'B'
	else:
		arr[i] = 'R'
	fun(arr, i + d, d)
t = int(input())
for __ in range(t):
	n = int(input())
	arr = list(input().strip(' '))
	for i in range(n):
		if i + 1 < n and arr[i] == '?' and (arr[i + 1] != '?'):
			fun(arr, i, -1)
		if i - 1 >= 0 and arr[i] == '?' and (arr[i - 1] != '?'):
			fun(arr, i, 1)
	if arr[-1] == '?':
		arr[-1] = 'B'
		if n - 2 >= 0:
			fun(arr, n - 2, -1)
	print(''.join(arr))


sr = lambda : input()
ir = lambda : int(sr())
lr = lambda : list(map(int, sr().split()))
inf = 10 ** 18
mod = 998244353
test = ir()
for t in range(test):
	n = ir()
	s = sr()
	ans1 = []
	c1 = 0
	pre = 'B'
	for i in range(n):
		if s[i] == 'R':
			if pre == 'R':
				c1 += 1
			pre = 'R'
			ans1.append('R')
		elif s[i] == 'B':
			if pre == 'B':
				c1 += 1
			pre = 'B'
			ans1.append('B')
		elif pre == 'B':
			pre = 'R'
			ans1.append('R')
		else:
			pre = 'B'
			ans1.append('B')
	ans2 = []
	c2 = 0
	pre = 'R'
	for i in range(n):
		if s[i] == 'R':
			if pre == 'R':
				c2 += 1
			pre = 'R'
			ans2.append('R')
		elif s[i] == 'B':
			if pre == 'B':
				c2 += 1
			pre = 'B'
			ans2.append('B')
		elif pre == 'B':
			pre = 'R'
			ans2.append('R')
		else:
			pre = 'B'
			ans2.append('B')
	if c1 < c2:
		print(''.join(ans1))
	else:
		print(''.join(ans2))


import sys
input = sys.stdin.readline
import bisect
from bisect import bisect_left
import math
from collections import defaultdict
from collections import Counter
from math import gcd

def SOE(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	l = []
	for p in range(2, n + 1):
		if prime[p]:
			l += [p]
	return prime

def i1():
	return int(input())

def i2():
	return map(int, input().split())

def i3():
	return list(map(int, input().split()))

def i4():
	return input()

def i5():
	return list(str(input()))
for _ in range(i1()):
	n = i1()
	s = i5()
	t = -1
	a = ''
	for i in range(n):
		if s[i] != '?':
			t = i
			break
	if t > 0:
		if t % 2 == 0 and s[t] == 'R':
			s[0] = 'R'
		elif t % 2 == 0 and s[t] == 'B':
			s[0] = 'B'
		elif t % 2 != 0 and s[t] == 'R':
			s[0] = 'B'
		elif t % 2 != 0 and s[t] == 'B':
			s[0] = 'R'
	if t == -1 and s[0] == '?':
		s[0] = 'R'
	for i in range(1, n):
		if s[i] == '?':
			if s[i - 1] == 'R':
				s[i] = 'B'
			else:
				s[i] = 'R'
	ans = a.join(s)
	print(ans, end='')


f = str.replace
for s in [*open(0)][2::2]:
	if {*s} == {*'?\n'}:
		s = 'R' + s[1:]
	while '?' in s:
		s = f(f(f(f(s, 'R?', 'RB'), 'B?', 'BR'), '?R', 'BR'), '?B', 'RB')
	print(s)


for t in range(int(input())):
	(N, S) = (int(input()), list(input()))
	cnt = 0
	for i in S:
		if i != '?':
			cnt += 1
	if not cnt:
		S[0] = 'R'
	for i in range(1, N):
		if S[i] == '?' and S[i - 1] != '?':
			S[i] = 'R' if S[i - 1] == 'B' else 'B'
	for j in range(N - 2, -1, -1):
		if S[j] == '?' and S[j + 1] != '?':
			S[j] = 'R' if S[j + 1] == 'B' else 'B'
	print(''.join(S))


import sys
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep='\n')

def II():
	return int(sys.stdin.readline())

def LI():
	return list(map(int, sys.stdin.readline().split()))

def LLI(rows_number):
	return [LI() for _ in range(rows_number)]

def LI1():
	return list(map(int1, sys.stdin.readline().split()))

def LLI1(rows_number):
	return [LI1() for _ in range(rows_number)]

def SI():
	return sys.stdin.readline().rstrip()
inf = 10 ** 16
md = 10 ** 9 + 7

def solve():
	n = II()
	s = SI()
	cc = list(s)
	if s.count('?') == n:
		cc[0] = 'R'
	for i in range(n - 1):
		if cc[i] != '?' and cc[i + 1] == '?':
			if cc[i] == 'R':
				cc[i + 1] = 'B'
			else:
				cc[i + 1] = 'R'
	cc.reverse()
	for i in range(n - 1):
		if cc[i] != '?' and cc[i + 1] == '?':
			if cc[i] == 'R':
				cc[i + 1] = 'B'
			else:
				cc[i + 1] = 'R'
	ans = ''.join(cc[::-1])
	print(ans)
for testcase in range(II()):
	solve()


import collections
import os
import sys
from datetime import date
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def main():
	pass

def binary(n):
	return bin(n).replace('0b', '')

def decimal(s):
	return int(s, 2)

def pow2(n):
	p = 0
	while n > 1:
		n //= 2
		p += 1
	return p

def isPrime(n):
	if n == 1:
		return False
	else:
		root = int(n ** 0.5)
		root += 1
		for i in range(2, root):
			if n % i == 0:
				return False
		return True

def lts(l):
	s = ''.join(map(str, l))
	return s

def stl(s):
	l = list(s)
	return l

def sq(a, target, arr=[]):
	s = sum(arr)
	if s == target:
		return arr
	if s >= target:
		return
	for i in range(len(a)):
		n = a[i]
		remaining = a[i + 1:]
		ans = sq(remaining, target, arr + [n])
		if ans:
			return ans

def SieveOfEratosthenes(n):
	cnt = 0
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	for p in range(2, n + 1):
		if prime[p]:
			cnt += 1
	return cnt

def nCr(n, r):
	f = math.factorial
	return f(n) // f(r) // f(n - r)
mod = int(1000000000.0) + 7
import math
import statistics
from bisect import bisect_right
for __ in range(int(input())):
	n = int(input())
	a = list(input())
	curr = ''
	ind = -1
	for i in range(n):
		if a[i] != '?':
			curr = a[i]
			ind = i
	if ind == -1:
		print('BR' * (n // 2) + 'B' * (n % 2))
	else:
		for i in range(ind, -1, -1):
			if a[i] == '?':
				if curr == 'B':
					a[i] = 'R'
					curr = 'R'
				else:
					a[i] = 'B'
					curr = 'B'
			else:
				curr = a[i]
		curr = a[ind]
		for i in range(ind + 1, n):
			if a[i] == '?':
				if curr == 'B':
					a[i] = 'R'
					curr = 'R'
				else:
					a[i] = 'B'
					curr = 'B'
			else:
				curr = a[i]
		print(''.join(map(str, a)))


t = int(input())
ans = []
d = {'R': 'B', 'B': 'R'}
for _ in range(t):
	n = int(input())
	s = list(input())
	i = j = 0
	while j < n:
		while j < n and s[j] != '?':
			j += 1
		i = j
		while j < n and s[j] == '?':
			j += 1
		if i == 0:
			if j == n:
				for k in range(0, n, 2):
					s[k] = 'B'
				for k in range(1, n, 2):
					s[k] = 'R'
			else:
				v = s[j]
				dv = d[v]
				for k in range(j - 2, i - 1, -2):
					s[k] = v
				for k in range(j - 1, i - 1, -2):
					s[k] = dv
		else:
			v = s[i - 1]
			dv = d[v]
			for k in range(i, j, 2):
				s[k] = dv
			for k in range(i + 1, j, 2):
				s[k] = v
	ans.append(''.join(s))
print('\n'.join(ans))


t = int(input())
for o in range(t):
	n = int(input())
	s = input()
	a = [0] * (n + 1)
	to = 0
	for i in range(n):
		if s[i] != '?':
			to = i
			break
	for i in range(to, n):
		if s[i] == '?':
			if a[i - 1] == 'R':
				a[i] = 'B'
			else:
				a[i] = 'R'
		else:
			a[i] = s[i]
	for i in range(to):
		if i % 2 == to % 2:
			print(a[to], end='')
		elif a[to] == 'B':
			print('R', end='')
		else:
			print('B', end='')
	for i in range(to, n):
		if i == n - 1:
			print(a[i])
		else:
			print(a[i], end='')


for _ in range(int(input())):
	n = int(input())
	s = list(input())
	ans = ''
	x = 0
	i = 0
	while i < n and s[i] == '?':
		x += 1
		i += 1
	flag = -1
	if i < n and s[i] == 'R':
		flag = 1
		if x % 2 == 0:
			ans += 'RB' * (x // 2)
		else:
			ans += 'BR' * (x // 2) + 'B'
	elif i < n and s[i] == 'B':
		flag = 0
		if x % 2 == 0:
			ans += 'BR' * (x // 2)
		else:
			ans += 'RB' * (x // 2) + 'R'
	if flag == -1:
		if x % 2 == 0:
			ans += 'RB' * (x // 2)
		else:
			ans += 'RB' * (x // 2) + 'R'
	while i < n:
		if s[i] == '?':
			if flag:
				ans += 'B'
				flag = 0
			else:
				ans += 'R'
				flag = 1
		elif s[i] == 'R':
			flag = 1
			ans += 'R'
		elif s[i] == 'B':
			flag = 0
			ans += 'B'
		i += 1
	print(ans)


def imp(len, l):
	s = list(l)
	cnt = 0
	str1 = ' '
	if len == 1 and s[0] == '?':
		s = 'B'
		return str1.join(s)
	i = 0
	while i < len:
		if s[i] == '?':
			if i == 0:
				if s[i + 1] == '?':
					while i < len and s[i] == '?':
						i += 1
					j = i - 1
					if j == len - 1:
						s[j] = 'R'
						j -= 1
					while s[j] == '?' and j >= 0:
						if s[j + 1] == 'B':
							s[j] = 'R'
						else:
							s[j] = 'B'
						j -= 1
				elif s[i + 1] == 'B':
					s[i] = 'R'
					i += 1
				elif s[i + 1] == 'R':
					s[i] = 'B'
					i += 1
			elif s[i - 1] == 'B':
				s[i] = 'R'
				i += 1
			else:
				s[i] = 'B'
				i += 1
		else:
			i += 1
	return str1.join(s).replace(' ', '')
n = int(input())
for i in range(n):
	x = int(input())
	s = input()[:x]
	print(imp(x, s))


t = int(input())
for i in range(t):
	n = int(input())
	s = input()
	a = []
	blankcount = 0
	for i in range(n):
		if s[i] == '?':
			a.append('')
			blankcount += 1
		else:
			a.append(s[i])
	if blankcount == n:
		a[0] = 'B'
		blankcount -= 1
	while blankcount != 0:
		for i in range(n - 1):
			if a[i] == '':
				if a[i + 1] == 'B':
					a[i] = 'R'
					blankcount -= 1
				elif a[i + 1] == 'R':
					a[i] = 'B'
					blankcount -= 1
			if blankcount == 0:
				break
		for i in range(1, n):
			if a[i] == '':
				if a[i - 1] == 'B':
					a[i] = 'R'
					blankcount -= 1
				elif a[i - 1] == 'R':
					a[i] = 'B'
					blankcount -= 1
				if blankcount == 0:
					break
	for x in a:
		print(x, end='')
	print()


import sys
import math
input = sys.stdin.readline
for _ in range(int(input())):
	n = int(input())
	a = input().strip()
	if a == '?' * n:
		a = a.replace('?', 'R', 1)
	while '?' in a:
		a = a.replace('R?', 'RB')
		a = a.replace('B?', 'BR')
		a = a.replace('?R', 'BR')
		a = a.replace('?B', 'RB')
	print(a)


t = int(input())
for i in range(t):
	n = int(input())
	s = [i for i in input()]
	if s.count('?') == n:
		k = 0
		for i in range(n):
			if k % 2 == 0:
				s[i] = 'B'
			else:
				s[i] = 'R'
			k += 1
		print(''.join(s))
	elif s.count('?') == 0:
		print(''.join(s))
	elif n == 1:
		print('B')
	elif s[0] == '?':
		ans1 = ['B']
		ans2 = ['R']
		for i in range(1, n):
			if s[i] == '?':
				if ans1[i - 1] == 'B':
					ans1.append('R')
				else:
					ans1.append('B')
				if ans2[i - 1] == 'B':
					ans2.append('R')
				else:
					ans2.append('B')
			else:
				ans1.append(s[i])
				ans2.append(s[i])
		cnt1 = 0
		cnt2 = 0
		for i in range(1, n):
			if ans1[i] == ans1[i - 1]:
				cnt1 += 1
		for i in range(1, n):
			if ans2[i] == ans2[i - 1]:
				cnt2 += 1
		if cnt1 < cnt2:
			print(''.join(ans1))
		else:
			print(''.join(ans2))
	else:
		ans = [s[0]]
		for i in range(1, n):
			if s[i] == '?':
				if s[i - 1] == 'B':
					s[i] = 'R'
				else:
					s[i] = 'B'
		print(''.join(s))


t = int(input())
while t > 0:
	len_s = int(input())
	s = list(input())
	if s == ['?']:
		print('B')
	elif s.count('?') == len_s:
		for x in range(0, len_s - 1, 2):
			(s[x], s[x + 1]) = ('B', 'R')
		if s[-2] == 'R':
			s[-1] = 'B'
		else:
			s[-1] = 'R'
		print(''.join(s))
	else:
		for j in range(len_s):
			for i in range(1, len_s, 1):
				if s[i - 1] == '?' and s[i - 1] != s[i]:
					if s[i] == 'R':
						s[i - 1] = 'B'
						continue
					elif s[i] == 'B':
						s[i - 1] = 'R'
						continue
				elif s[i - 1] != '?' and s[i] != '?':
					continue
				elif (s[i - 1], s[i]) == ('R', '?'):
					s[i] = 'B'
					continue
				elif (s[i - 1], s[i]) == ('B', '?'):
					s[i] = 'R'
					continue
				else:
					continue
		print(''.join(s))
	t -= 1


import sys
import math
from bisect import bisect_right as br

def int_arr():
	return list(map(int, sys.stdin.readline().split()))

def str_arr():
	return list(map(str, sys.stdin.readline().split()))

def input():
	return sys.stdin.readline().strip()
mod = 1000000007
for _ in range(int(input())):
	n = int(input())
	st = input()
	arr = []
	ans = []
	if st[0] != '?':
		for i in range(n):
			if st[i] != '?':
				arr.append(st[i])
			elif arr[i - 1] == 'R':
				arr.append('B')
			else:
				arr.append('R')
		for k in arr:
			ans.append(k)
		print(''.join((str(v) for v in ans)))
	else:
		arr = ['R']
		arr2 = ['B']
		for i in range(1, n):
			if st[i] != '?':
				arr.append(st[i])
			elif arr[i - 1] == 'R':
				arr.append('B')
			else:
				arr.append('R')
		for i in range(1, n):
			if st[i] != '?':
				arr2.append(st[i])
			elif arr2[i - 1] == 'R':
				arr2.append('B')
			else:
				arr2.append('R')
		c1 = 0
		c2 = 0
		prev1 = 0
		prev2 = 0
		ans = []
		for k in range(n):
			if arr[k] == prev1:
				c1 += 1
			if arr2[k] == prev2:
				c2 += 1
			prev1 = arr[k]
			prev2 = arr2[k]
		if c1 < c2:
			for l in arr:
				ans.append(l)
			print(''.join((str(v) for v in ans)))
		else:
			for l in arr2:
				ans.append(l)
			print(''.join((str(v) for v in ans)))


T = int(input())
for t in range(T):
	n = int(input())
	squares = list(input())
	index_of_first_color = None
	for i in range(n):
		if squares[i] != '?':
			index_of_first_color = i
			break
	if index_of_first_color is None:
		s = 'BR' * (n // 2)
		if n % 2 == 1:
			s = s + 'B'
		print(s)
		continue
	if index_of_first_color > 0:
		for i in range(index_of_first_color):
			if squares[index_of_first_color - i] == 'B':
				squares[index_of_first_color - 1 - i] = 'R'
			else:
				squares[index_of_first_color - 1 - i] = 'B'
	for i in range(index_of_first_color + 1, n):
		if squares[i] == '?':
			if squares[i - 1] == 'B':
				squares[i] = 'R'
			else:
				squares[i] = 'B'
	print(''.join(squares))


for _ in range(int(input())):
	n = int(input())
	(i, f) = (0, 0)
	s = list(input())
	while i < n:
		flag = 0
		if s[i] == 'B' or s[i] == 'R':
			f = 1
			if i > 0 and s[i - 1] == '?':
				x = i - 1
				while x >= 0 and s[x] == '?':
					if s[x + 1] == 'R':
						s[x] = 'B'
					else:
						s[x] = 'R'
					x -= 1
			if i < n - 1 and s[i + 1] == '?':
				y = i
				while y < n - 1 and s[y + 1] == '?':
					if s[y] == 'R':
						s[y + 1] = 'B'
					else:
						s[y + 1] = 'R'
					y += 1
					flag = 1
		if flag == 1:
			i = y
		else:
			i += 1
	if f == 0:
		for i in range(n):
			if i % 2 == 0 and s[i] == '?':
				s[i] = 'B'
			elif i % 2 and s[i] == '?':
				s[i] = 'R'
	print(''.join(s))


def opp(x):
	if x == 'R':
		return 'B'
	else:
		return 'R'
for _ in range(int(input())):
	n = int(input())
	s = input()
	s = list(s)
	c = 0
	for i in range(n):
		if s[i] != '?':
			break
		else:
			c += 1
	if c == n:
		s[0] = 'R'
		for x in range(1, n):
			if s[x] == '?':
				s[x] = opp(s[x - 1])
	else:
		if c % 2 == 0:
			s[0] = s[i]
		else:
			s[0] = opp(s[i])
		for x in range(1, i):
			s[x] = opp(s[x - 1])
		for x in range(i + 1, n):
			if s[x] == '?':
				s[x] = opp(s[x - 1])
	s = ''.join(s)
	print(s)


import os
import sys
from io import BytesIO, IOBase
import math
from collections import Counter

def func(n, array):
	result = []
	last = None
	next_index = None
	for (i, val) in enumerate(array):
		if val != '?':
			if i % 2 == 0:
				first = val
				second = list(set(['B', 'R']) - set([val]))[0]
			else:
				first = list(set(['B', 'R']) - set([val]))[0]
				second = val
			result = ([first, second] * (i + 1))[:i + 1]
			last = val
			next_index = i + 1
			break
	if next_index is None:
		return ''.join(['B', 'R'] * len(array))[:len(array)]
	for val in array[next_index:]:
		if val != '?':
			result.append(val)
			last = val
		else:
			last = list(set(['B', 'R']) - set([last]))[0]
			result.append(last)
	return ''.join(result)

def main():
	num_test = int(parse_input())
	result = []
	for _ in range(num_test):
		n = int(parse_input())
		array = parse_input()
		result.append(func(n, array))
	print('\n'.join(map(str, result)))
parse_input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


def func():
	st1 = 'B'
	st2 = 'R'
	flag_b = True
	flag_r = True
	if a[0] == 'R':
		flag_b = False
	if a[0] == 'B':
		flag_r = False
	for i in range(1, n):
		if a[i] == '?':
			if st1[-1] == 'R':
				st1 += 'B'
			elif st1[-1] == 'B':
				st1 += 'R'
			if st2[-1] == 'R':
				st2 += 'B'
			elif st2[-1] == 'B':
				st2 += 'R'
		else:
			st2 += a[i]
			st1 += a[i]
	ans1 = 0
	ans2 = 0
	for i in range(1, n):
		if st1[i] == st1[i - 1]:
			ans1 += 1
		if st2[i] == st2[i - 1]:
			ans2 += 1
	if flag_b and flag_r:
		if ans1 > ans2:
			print(st2)
		else:
			print(st1)
	elif flag_b:
		print(st1)
	else:
		print(st2)
for _ in range(int(input())):
	n = int(input())
	a = list(input())
	func()


n = int(input())
for i in range(n):
	tam = int(input())
	seq = input()
	i = 0
	while '?' in seq and i < tam:
		if tam == 1:
			seq = 'B'
		elif 'B' not in seq and 'R' not in seq:
			e = 0
			while '?' in seq:
				seq = seq[:e] + 'B' + seq[e + 1:]
				seq = seq[:e + 1] + 'R' + seq[e + 2:]
				e += 2
			if len(seq) > tam:
				seq = seq[:-1]
		elif seq[i] == '?' and i == 0:
			y = i
			while seq[y] == '?':
				y += 1
			z = 0
			while z < y:
				if y % 2 == 1:
					if seq[y] == 'B':
						seq = seq[:z] + 'R' + seq[z + 1:]
						seq = seq[:z + 1] + 'B' + seq[z + 2:]
						z += 2
					else:
						seq = seq[:z] + 'B' + seq[z + 1:]
						seq = seq[:z + 1] + 'R' + seq[z + 2:]
						z += 2
				elif seq[y] == 'B':
					seq = seq[:z] + 'B' + seq[z + 1:]
					seq = seq[:z + 1] + 'R' + seq[z + 2:]
					z += 2
				else:
					seq = seq[:z] + 'R' + seq[z + 1:]
					seq = seq[:z + 1] + 'B' + seq[z + 2:]
					z += 2
		if seq[i] == '?':
			if seq[i - 1] == 'B':
				seq = seq[:i] + 'R' + seq[i + 1:]
			elif seq[i - 1] == 'R':
				seq = seq[:i] + 'B' + seq[i + 1:]
		else:
			i += 1
	print(seq)


from collections import defaultdict as di

def solve(a):
	c = 0
	for i in a:
		if i == '?':
			c += 1
	if c == len(a):
		for i in range(len(a)):
			if i % 2 == 0:
				a[i] = 'R'
			else:
				a[i] = 'B'
		return a
	i = 0
	while i < len(a):
		if a[i] != '?':
			left = i - 1
			right = i + 1
			while left >= 0 and a[left] == '?':
				if a[left + 1] == 'B':
					a[left] = 'R'
				else:
					a[left] = 'B'
				left -= 1
			while right < len(a) and a[right] == '?':
				if a[right - 1] == 'B':
					a[right] = 'R'
				else:
					a[right] = 'B'
				right += 1
			i = right
		else:
			i += 1
	return a
for _ in range(int(input())):
	n = int(input())
	a = list(input())
	z = solve(a)
	print(''.join(z))


def Rsolve(s, i, j):
	if i == 0 and j == len(s):
		return 'RB' * int(len(s) / 2) + 'R' * int(len(s) % 2 == 1)
	elif i == 0:
		temp = s[j]
		if temp == 'R':
			if j % 2:
				return 'BR' * int(j / 2) + 'B'
			else:
				return 'RB' * int(j / 2)
		elif j % 2:
			return 'RB' * int(j / 2) + 'R'
		else:
			return 'BR' * int(j / 2)
	elif j == len(s):
		temp = s[i - 1]
		if temp == 'R':
			return 'BR' * int((j - i) / 2) + 'B' * int((j - i) % 2)
		else:
			return 'RB' * int((j - i) / 2) + 'R' * int((j - i) % 2)
	else:
		temp = s[i - 1]
		if temp == 'R':
			return 'BR' * int((j - i) / 2) + 'B' * int((j - i) % 2)
		else:
			return 'RB' * int((j - i) / 2) + 'R' * int((j - i) % 2)

def solve(s):
	i = 0
	ss = ''
	while i < len(s):
		if s[i] == '?':
			temp = i
			while i < len(s) and s[i] == '?':
				i = i + 1
			ss = ss + Rsolve(s, temp, i)
		else:
			ss = ss + s[i]
			i = i + 1
	return ss
n = int(input())
for i in range(n):
	NUM = input()
	s = input()
	print(solve(s))


from collections import Counter
import math

def solve():
	n = int(input())
	a = list(input())
	i = 0
	cur = -1
	while i < n and cur == -1:
		if a[i] != '?':
			cur = a[i]
		else:
			i += 1
	for j in range(i - 1, -1, -1):
		if cur == 'R':
			cur = 'B'
		else:
			cur = 'R'
		a[j] = cur
	if i < n:
		cur = a[i]
	else:
		cur = 'R'
	for j in range(i + 1, n):
		if a[j] == '?':
			if cur == 'R':
				cur = 'B'
			else:
				cur = 'R'
			a[j] = cur
		else:
			cur = a[j]
	print(''.join(a))
t = int(input())
while t:
	t -= 1
	solve()


a = int(input())
for x in range(a):
	b = int(input())
	c = input()
	if c == '?' * b:
		c = c.replace('?', 'B', 1)
	while '?' in c:
		c = c.replace('?R', 'BR')
		c = c.replace('R?', 'RB')
		c = c.replace('?B', 'RB')
		c = c.replace('B?', 'BR')
	print(c)


def fix(s):
	for i in range(len(s)):
		if i != 0 and s[i] == '?' and (s[i - 1] != '?'):
			s[i] = 'R' if s[i - 1] == 'B' else 'B'
	for i in range(len(s)):
		if i != len(s) - 1 and s[i] == '?' and (s[i + 1] != '?'):
			s[i] = 'R' if s[i + 1] == 'B' else 'B'
	if '?' not in s:
		return ''.join(s)
	return fix(s)
for _ in range(int(input())):
	N = int(input())
	s = list(input())
	if 'B' not in s and 'R' not in s:
		print(('BR' * N)[:N])
	else:
		print(fix(s))


t = int(input())
for i in range(t):
	n = int(input())
	a = list(input())
	ans = ''
	k = 0
	while k < n and a[k] == '?':
		k += 1
	if k == n:
		c = 1
		for h in range(n):
			if c:
				print('B', end='')
			else:
				print('R', end='')
			c = 1 - c
		print()
	else:
		if a[k] == 'R' and k % 2 == 1 or (a[k] == 'B' and k % 2 == 0):
			c = 1
		else:
			c = 0
		for j in range(n):
			if a[j] == '?':
				if j == 0:
					if c == 1:
						a[0] = 'B'
					else:
						a[0] = 'R'
					print(a[j], end='')
				elif a[j - 1] == 'R':
					print('B', end='')
					a[j] = 'B'
				else:
					a[j] = 'R'
					print('R', end='')
			else:
				print(a[j], end='')
		print()


numcases = int(input(''))
case = 'BRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBR'
for i in range(numcases):
	n = int(input(''))
	squares = input('')
	squares = [i for i in squares]
	numSym = 0
	res = ''
	for i in squares:
		if i == '?':
			numSym += 1
	if numSym == n:
		res = case[:n]
		numSym = 0
	while numSym != 0:
		for i in range(n):
			if i == 0:
				if squares[i] == 'B' and squares[i + 1] == '?':
					squares[i + 1] = 'R'
					numSym -= 1
				elif squares[i] == 'R' and squares[i + 1] == '?':
					squares[i + 1] = 'B'
					numSym -= 1
			elif i == n - 1:
				if squares[i] == 'B' and squares[i - 1] == '?':
					squares[i - 1] = 'R'
					numSym -= 1
				elif squares[i] == 'R' and squares[i - 1] == '?':
					squares[i - 1] = 'B'
					numSym -= 1
			elif squares[i] == 'B':
				if squares[i + 1] == '?':
					squares[i + 1] = 'R'
					numSym -= 1
				if squares[i - 1] == '?':
					squares[i - 1] = 'R'
					numSym -= 1
			elif squares[i] == 'R':
				if squares[i + 1] == '?':
					squares[i + 1] = 'B'
					numSym -= 1
				if squares[i - 1] == '?':
					squares[i - 1] = 'B'
					numSym -= 1
	if res == '':
		for i in squares:
			res = res + i
	print(res)


import re
f = re.sub
for s in [*open(0)][2::2]:
	while '?' in s:
		for _ in '__':
			s = f('B\\?|\\?R', 'BR', f('^\\?(\\?*)\\s', 'R\\1', s[::-1]))
	print(s)


t = int(input())
while t:
	n = int(input())
	S = input()
	s = list(S)
	a = -1
	for i in range(n):
		if s[i] != '?':
			a = i
			break
	if n == 1:
		if s[0] == '?':
			print('B')
		else:
			print(s[0])
	elif a == -1:
		for i in range(n):
			if i % 2 == 0:
				s[i] = 'B'
			else:
				s[i] = 'R'
		print(''.join(s))
	else:
		for i in range(a, 0, -1):
			if s[i] == 'R' and s[i - 1] == '?':
				s[i - 1] = 'B'
			elif s[i] == 'B' and s[i - 1] == '?':
				s[i - 1] = 'R'
		for i in range(a, n - 1):
			if s[i] == 'R' and s[i + 1] == '?':
				s[i + 1] = 'B'
			elif s[i] == 'B' and s[i + 1] == '?':
				s[i + 1] = 'R'
		print(''.join(s))
	t -= 1


import sys
input = sys.stdin.readline

def inp():
	return int(input())

def input_list():
	return list(map(int, input().split()))

def input_string():
	s = input()
	return list(s[:len(s) - 1])

def input_int_gen():
	return map(int, input().split())
dif = {'R': 'B', 'B': 'R'}
tests = inp()
for _ in range(tests):
	size = inp()
	squares = input_string()
	if squares[0] == '?':
		idx = 0
		while idx < size and squares[idx] == '?':
			idx += 1
		if idx == size:
			print(('RB' * (size // 2 + 1))[:size])
			continue
		while idx > 0:
			squares[idx - 1] = dif[squares[idx]]
			idx -= 1
	for idx in range(size):
		if squares[idx] == '?':
			squares[idx] = dif[squares[idx - 1]]
	print(''.join(squares))


for _ in range(int(input())):
	n = int(input())
	s = list(input())
	if s[0] == '?':
		c = 0
		f = '?'
		for i in range(n):
			if s[i] == '?':
				c += 1
			else:
				f = s[i]
				break
		if f == '?':
			for i in range(n):
				if i % 2 == 0:
					s[i] = 'B'
				else:
					s[i] = 'R'
		else:
			for i in range(c - 1, -1, -1):
				if f == 'B':
					s[i] = 'R'
					f = 'R'
				else:
					s[i] = 'B'
					f = 'B'
	for i in range(n):
		if s[i] == '?':
			if f == 'B':
				s[i] = 'R'
			else:
				s[i] = 'B'
			f = s[i]
		else:
			f = s[i]
	print(''.join(s))


t = int(input())
for i in range(t):
	n = int(input())
	s = []
	s[:] = input()
	arr = []
	firstfound = False
	for letter in range(len(s)):
		if firstfound == False:
			if letter == 0 and s[letter] == '?':
				s[letter] = 'R'
				arr.append('B')
			elif letter > 0 and s[letter] == '?':
				if s[letter - 1] == 'B':
					s[letter] = 'R'
					arr.append('B')
				elif s[letter - 1] == 'R':
					s[letter] = 'B'
					arr.append('R')
			elif letter > 0 and s[letter] != '?':
				if s[letter] == s[letter - 1]:
					for i in range(len(arr)):
						s[i] = arr[i]
				firstfound = True
		if firstfound:
			if s[letter] == '?':
				if s[letter - 1] == 'B':
					s[letter] = 'R'
				else:
					s[letter] = 'B'
	print(''.join(s))


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
from itertools import permutations
from collections import *
from collections import deque
from operator import itemgetter, attrgetter
from decimal import *
import bisect
import math
import heapq as hq
MOD = 10 ** 9 + 7

def is_prime(n):
	if n == 2 or n == 3:
		return True
	if n < 2 or n % 2 == 0:
		return False
	if n < 9:
		return True
	if n % 3 == 0:
		return False
	r = int(n ** 0.5)
	f = 5
	while f <= r:
		if n % f == 0:
			return False
		if n % (f + 2) == 0:
			return False
		f += 6
	return True

def pow(a, b, m):
	ans = 1
	while b:
		if b & 1:
			ans = ans * a % m
		b //= 2
		a = a * a % m
	return ans

def ispalindrome(s):
	if s[:] == s[::-1]:
		return 1
	return 0
dp = []
limit = []
v = []

def dpdfs(u, t=-1):
	dp[0][u] = 0
	dp[1][u] = 0
	for i in v[u]:
		if i == t:
			continue
		if dp[1][i] == -1:
			dpdfs(i, u)
		dp[0][u] += max(abs(limit[0][u] - limit[1][i]) + dp[1][i], abs(limit[0][u] - limit[0][i]) + dp[0][i])
		dp[1][u] += max(abs(limit[1][u] - limit[1][i]) + dp[1][i], abs(limit[1][u] - limit[0][i]) + dp[0][i])
vis = []
f = 0

def dfs(i):
	vis[i] = 1
	act[i] = 1
	for j in v[i]:
		if act[j]:
			f = 1
			return -1
		if vis[j] == 0:
			if dfs(j) == -1:
				return -1
	act[i] = 0
	ans.append(i)
	return 0
from queue import PriorityQueue

def z_algorithm(s):
	res = [0] * len(s)
	res[0] = len(s)
	(i, j) = (1, 0)
	while i < len(s):
		while i + j < len(s) and s[j] == s[i + j]:
			j += 1
		res[i] = j
		if j == 0:
			i += 1
			continue
		k = 1
		while i + k < len(s) and k + res[k] < j:
			res[i + k] = res[k]
			k += 1
		(i, j) = (i + k, j - k)
	return res

def gcd(a, b):
	if a == 0:
		return b
	return gcd(b % a, a)

def lcm(a, b):
	return a * b / math.gcd(int(a), int(b))

def gcdExtended(a, b):
	if a == 0:
		return (b, 0, 1)
	(gcd, x1, y1) = gcdExtended(b % a, a)
	x = y1 - b // a * x1
	y = x1
	return (gcd, x, y)

def give(x):
	if x == 'B':
		return 'R'
	return 'B'
for _ in range(int(input())):
	n = int(input())
	s = input()
	first = -1
	for i in range(n):
		if s[i] != '?':
			first = i
			break
	if first == -1:
		ans = 'BR' * (1 + n // 2)
		print(ans[:n])
		continue
	ans = [s[i] for i in range(n)]
	if first == 0:
		for i in range(1, n):
			if ans[i] == '?':
				ans[i] = give(ans[i - 1])
		print(''.join(ans))
		continue
	for i in range(first - 1, -1, -1):
		ans[i] = give(ans[i + 1])
	for i in range(first + 1, n):
		if ans[i] == '?':
			ans[i] = give(ans[i - 1])
	print(''.join(ans))


import sys
import math
import heapq
import bisect
from collections import Counter
from collections import defaultdict
from io import BytesIO, IOBase
from itertools import permutations
import string

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		import os
		self.os = os
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None
		self.BUFSIZE = 8192

	def read(self):
		while True:
			b = self.os.read(self._fd, max(self.os.fstat(self._fd).st_size, self.BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = self.os.read(self._fd, max(self.os.fstat(self._fd).st_size, self.BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			self.os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def get_int():
	return int(input())

def get_ints():
	return list(map(int, input().split(' ')))

def get_int_grid(n):
	return [get_ints() for _ in range(n)]

def get_str():
	return input().strip()

def get_strs():
	return get_str().split(' ')

def flat_list(arr):
	return [item for subarr in arr for item in subarr]

def yes_no(b):
	if b:
		return 'YES'
	else:
		return 'NO'

def binary_search(good, left, right, delta=1, right_true=False):
	limits = [left, right]
	while limits[1] - limits[0] > delta:
		if delta == 1:
			mid = sum(limits) // 2
		else:
			mid = sum(limits) / 2
		if good(mid):
			limits[int(right_true)] = mid
		else:
			limits[int(~right_true)] = mid
	if good(limits[int(right_true)]):
		return limits[int(right_true)]
	else:
		return False

def prefix_sums(a):
	p = [0]
	for x in a:
		p.append(p[-1] + x)
	return p

def solve_a():
	n = get_int()
	a = get_ints()
	x = a[0]
	for i in range(1, n):
		x &= a[i]
	return x

def solve_b():
	n = get_int()
	s = list(get_str())
	if s.count('?') == n:
		s[0] = 'R'
	if True:
		while s.count('?') > 0:
			for i in range(n):
				if s[i] != '?':
					pass
				elif i == 0:
					if s[i + 1] == 'B':
						s[i] = 'R'
					elif s[i + 1] == 'R':
						s[i] = 'B'
				elif i == n - 1:
					if s[i - 1] == 'B':
						s[i] = 'R'
					elif s[i - 1] == 'R':
						s[i] = 'B'
				elif 'B' in set([s[i - 1], s[i + 1]]):
					s[i] = 'R'
				elif 'R' in set([s[i - 1], s[i + 1]]):
					s[i] = 'B'
	return ''.join(s)
t = get_int()
for _ in range(t):
	print(solve_b())


from heapq import heapify, heappush, heappop, heappushpop
from collections import defaultdict as dd, deque as dq, Counter as C
from math import factorial as f, ceil, gcd, sqrt, log
from bisect import bisect_left as bl, bisect_right as br
from itertools import combinations as c, permutations as p
from math import factorial as f, ceil, gcd, sqrt, log
from sys import stdin, stdout
input = stdin.readline
mp = lambda : map(int, input().split())
it = lambda : int(input())
ls = lambda : list(input().strip())
mt = lambda r: [ls() for _ in range(r)]
lcm = lambda a, b: a * b // gcd(a, b)
for _ in range(it()):
	a = it()
	b = list(input().strip())
	if b == ['?' for i in range(a)]:
		b[0] = 'R'
		for i in range(1, a):
			if b[i - 1] == 'R':
				b[i] = 'B'
			else:
				b[i] = 'R'
		print(''.join(b))
	else:
		t = 200
		while t:
			for i in range(a - 1):
				if b[i] == '?':
					if b[i + 1] == 'R':
						b[i] = 'B'
					elif b[i + 1] == 'B':
						b[i] = 'R'
			for i in range(1, a):
				if b[i] == '?':
					if b[i - 1] == 'R':
						b[i] = 'B'
					elif b[i - 1] == 'B':
						b[i] = 'R'
			t -= 1
		print(''.join(b))


from collections import deque
t = int(input())
for u in range(t):
	n = int(input())
	a = input()
	s = []
	for i in a:
		s.append(i)
	q = deque()
	v = 0
	for i in range(n):
		if s[i] != '?':
			f = 0
			if i != 0 and s[i - 1] == '?':
				f += 1
			if i + 1 < n and s[i + 1] == '?':
				f += 1
			if f > 0:
				q.append(i)
			v += 1
	if v == n:
		print(a)
	elif v == 0:
		for i in range(n):
			if i % 2 == 0:
				s[i] = 'B'
			else:
				s[i] = 'R'
		for i in s:
			print(i, end='')
		print()
	else:
		while v < n:
			te = q.popleft()
			if te != 0 and s[te - 1] == '?':
				if s[te] == 'R':
					s[te - 1] = 'B'
				else:
					s[te - 1] = 'R'
				if te - 1 != 0 and s[te - 2] == '?':
					q.append(te - 1)
				v += 1
			if te + 1 < n and s[te + 1] == '?':
				if s[te] == 'R':
					s[te + 1] = 'B'
				else:
					s[te + 1] = 'R'
				if te + 1 != n - 1 and s[te + 2] == '?':
					q.append(te + 1)
				v += 1
		for i in s:
			print(i, end='')
		print()


def make_br(start, length, r=False):
	ret = []
	for _ in range(length):
		ret.append(start)
		start = reverse_br(start)
	if r:
		ret.reverse()
	return ''.join(ret)

def reverse_br(char):
	if char == 'B':
		return 'R'
	return 'B'

def f(n):
	ans = []
	segment = []
	pre = [n[0]]
	for i in n[1:]:
		if pre[-1] == '?' and i == '?':
			pre.append('?')
		elif pre[-1] != '?' and i != '?':
			pre.append(i)
		else:
			segment.append(''.join(pre))
			pre = [i]
	segment.append(''.join(pre))
	if len(segment) == 1 and segment[0][0] == '?':
		return make_br('B', len(segment[0]))
	if len(segment) == 1 and segment[0][0] != '?':
		return n
	for (i, s) in enumerate(segment):
		if s[0] == '?':
			if i == 0:
				a = make_br(reverse_br(segment[1][0]), len(s))
				ans.append(a[::-1])
			elif i == len(segment) - 1:
				a = make_br(reverse_br(segment[i - 1][-1]), len(s), r=True)
				ans.append(a[::-1])
			else:
				tmp = make_br(reverse_br(segment[i - 1][-1]), len(s))
				ans.append(tmp)
		else:
			ans.append(s)
	return ''.join(ans)

def main():
	for _ in range(int(input())):
		input()
		n = input()
		print(f(n))
main()


t = int(input())
while t:
	size = int(input())
	s = list(input())
	start = 0
	end = 0
	while end < size:
		while start < end and s[start] != '?':
			start += 1
		if s[end] == 'R':
			while start < end:
				if (end - start) % 2:
					s[start] = 'B'
				else:
					s[start] = 'R'
				start += 1
		elif s[end] == 'B':
			while start < end:
				if (end - start) % 2:
					s[start] = 'R'
				else:
					s[start] = 'B'
				start += 1
		end += 1
	if s[end - 1] == '?':
		while start < end and s[start] != '?':
			start += 1
		if start == 0:
			s[start] = 'B'
			start += 1
		while start < end:
			if s[start - 1] == 'B':
				s[start] = 'R'
			else:
				s[start] = 'B'
			start += 1
	print(''.join(map(str, s)))
	t -= 1


t = int(input())
for i in range(t):
	n = int(input())
	arr = list(input())
	a = [0] * len(arr)
	c = -1
	for ele in arr:
		c += 1
		if ele == '?':
			a[c] = -1
		elif ele == 'R':
			a[c] = 0
		else:
			a[c] = 1
	x = 0
	l = len(arr)
	a1 = [-1] * len(arr)
	for j in range(l):
		if a[j] == -1:
			a1[j] = 1 - x
			x = 1 - x
		else:
			a1[j] = a[j]
			x = a[j]
	x = 1
	a2 = [-1] * len(arr)
	for j in range(l):
		if a[j] == -1:
			a2[j] = 1 - x
			x = 1 - x
		else:
			a2[j] = a[j]
			x = a[j]
	count1 = 0
	for j in range(l - 1):
		if a1[j] == a1[j + 1]:
			count1 += 1
	count2 = 0
	for j in range(l - 1):
		if a2[j] == a2[j + 1]:
			count2 += 1
	if count1 < count2:
		for ele in a1:
			if ele == 0:
				print('R', end='')
			else:
				print('B', end='')
	else:
		for ele in a2:
			if ele == 0:
				print('R', end='')
			else:
				print('B', end='')
	print()


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	(n, s) = (int(input()), input().strip())
	if s.count('?') == n:
		print(('BR' * (n // 2 + 1))[:n])
	else:
		while '?' in s:
			s = s.replace('?R', 'BR').replace('R?', 'RB').replace('?B', 'RB').replace('B?', 'BR')
		print(s)


for _ in range(int(input())):
	n = int(input())
	s = input()
	i = 0
	last = False
	for i in range(n):
		if s[i] != '?':
			last = (s[i] == 'B') != bool(i % 2)
			break
	result = ''
	for i in s:
		if i == '?':
			result += 'B' if last else 'R'
			last = not last
		else:
			result += i
			last = i == 'R'
	print(result)


for _ in range(int(input())):
	n = int(input())
	l = list(input())
	a = -1
	r = 'R'
	b = 'B'
	q = '?'
	for i in range(n):
		if l[i] != q:
			a = i
			break
	if a == -1:
		for k in range(n):
			if k % 2 == 0:
				l[k] = r
			else:
				l[k] = b
	else:
		for j in range(a, 0, -1):
			if l[j - 1] == '?':
				if l[j] == r:
					l[j - 1] = b
				else:
					l[j - 1] = r
		for o in range(a, n - 1):
			if l[o + 1] == '?':
				if l[o] == r:
					l[o + 1] = b
				else:
					l[o + 1] = r
	print(''.join(l))


typ_1 = ['B', 'R'] * 50
typ_2 = ['R', 'B'] * 50
T = int(input())
while T:
	l = int(input())
	arr = list(input())
	final = [None] * l
	i = l + 1
	for (j, ele) in enumerate(arr):
		if ele == '?':
			continue
		else:
			i = j
			break
	if i < l + 1:
		if typ_1[i] == arr[i]:
			final[:i + 1] = typ_1[:i + 1]
		else:
			final[:i + 1] = typ_2[:i + 1]
		if i == l:
			print(''.join((str(elem) for elem in final)))
			T -= 1
			continue
		for j in range(i + 1, l):
			if arr[j] == '?':
				if final[j - 1] == 'B':
					final[j] = 'R'
				else:
					final[j] = 'B'
			else:
				final[j] = arr[j]
	else:
		final = typ_1[:l]
	ans = ''.join((str(elem) for elem in final))
	print(ans)
	T -= 1


import sys
import math
import random
from queue import PriorityQueue as PQ
from bisect import bisect_left as BSL
from bisect import bisect_right as BSR
from collections import OrderedDict as OD
from collections import Counter
from itertools import permutations
mod = 1000000007
try:
	sys.stdin = open('actext.txt', 'r')
	OPENFILE = 1
except:
	pass

def get_ints():
	return map(int, input().split())

def palindrome(s):
	mid = len(s) // 2
	for i in range(mid):
		if s[i] != s[len(s) - i - 1]:
			return False
	return True

def check(i, n):
	if 0 <= i < n:
		return True
	else:
		return False
t = int(input())
for tt in range(t):
	n = int(input())
	s = input()
	ans = [0 for i in range(n)]
	ii = 0
	while ii < n and s[ii] == '?':
		ii += 1
	if ii == n:
		ii = n - 1
		ans[ii] = 'B'
		prev = 'B'
	else:
		prev = s[ii]
		ans[ii] = prev
	jj = ii - 1
	while jj >= 0:
		if prev == 'R':
			prev = 'B'
		else:
			prev = 'R'
		ans[jj] = prev
		jj -= 1
	jj = ii + 1
	prev = s[ii]
	while jj < n:
		if s[jj] != '?':
			prev = s[jj]
		elif prev == 'R':
			prev = 'B'
		else:
			prev = 'R'
		ans[jj] = prev
		jj += 1
	print(''.join(ans))


t = int(input())
for _ in range(t):
	n = int(input())
	s = list(input())
	c = 0
	for i in range(n):
		if s[i] == '?':
			c = c + 1
		else:
			break
	if c != 0 and c < n:
		if c % 2 == 0 and s[c] == 'B':
			s[0] = 'B'
		elif c % 2 == 0 and s[c] == 'R':
			s[0] = 'R'
		elif c % 2 != 0 and s[c] == 'R':
			s[0] = 'B'
		elif c % 2 != 0 and s[c] == 'B':
			s[0] = 'R'
	if c == n:
		s[0] = 'R'
	for i in range(1, n):
		if s[i] == '?':
			if s[i - 1] == 'B':
				s[i] = 'R'
			else:
				s[i] = 'B'
	for i in range(n):
		print(s[i], end='')
	print()


import sys
from collections import Counter
import math
import bisect
import heapq
from itertools import combinations
from collections import defaultdict
num_cases = int(sys.stdin.readline().strip())
for case in range(1, num_cases + 1):
	N = int(sys.stdin.readline().strip())
	S = str(sys.stdin.readline().strip())
	if N == S.count('?'):
		if N % 2 == 0:
			print('BR' * (N // 2))
		else:
			print('R' + 'BR' * (N // 2))
	else:
		if S[0] == '?':
			left_thing = '0'
			left_pos = -1
			for i in range(len(S)):
				if S[i] != '?':
					left_thing = S[i]
					left_pos = i
					break
			if left_thing == 'R':
				num_question = left_pos
				if num_question % 2 == 0:
					S = 'RB' * (num_question // 2) + S[left_pos:]
				else:
					S = 'B' + 'RB' * (num_question // 2) + S[left_pos:]
			else:
				num_question = left_pos
				if num_question % 2 == 0:
					S = 'BR' * (num_question // 2) + S[left_pos:]
				else:
					S = 'R' + 'BR' * (num_question // 2) + S[left_pos:]
		S = S[::-1]
		if S[0] == '?':
			left_thing = '0'
			left_pos = -1
			for i in range(len(S)):
				if S[i] != '?':
					left_thing = S[i]
					left_pos = i
					break
			if left_thing == 'R':
				num_question = left_pos
				if num_question % 2 == 0:
					S = 'RB' * (num_question // 2) + S[left_pos:]
				else:
					S = 'B' + 'RB' * (num_question // 2) + S[left_pos:]
			else:
				num_question = left_pos
				if num_question % 2 == 0:
					S = 'BR' * (num_question // 2) + S[left_pos:]
				else:
					S = 'R' + 'BR' * (num_question // 2) + S[left_pos:]
		S = S[::-1]
		stack = 0
		result = ''
		for i in range(len(S)):
			if S[i] != '?':
				if stack == 0:
					result += S[i]
				else:
					most_left = result[-1]
					most_right = S[i]
					if most_left == most_right:
						if most_left == 'R':
							if stack % 2 == 0:
								result += 'BR' * (stack // 2)
							else:
								result += 'BR' * (stack // 2) + 'B'
						elif stack % 2 == 0:
							result += 'RB' * (stack // 2)
						else:
							result += 'RB' * (stack // 2) + 'R'
					elif most_left == 'R':
						if stack % 2 == 0:
							result += 'BR' * (stack // 2)
						else:
							result += 'BR' * (stack // 2) + 'B'
					elif stack % 2 == 0:
						result += 'RB' * (stack // 2)
					else:
						result += 'RB' * (stack // 2) + 'R'
					result += S[i]
					stack = 0
			else:
				stack += 1
		print(result)


for _ in range(int(input())):
	n = int(input())
	s = input()
	if s == '?' * n:
		s = 'R' + s[1:]
	while '?' in s:
		s = s.replace('?R', 'BR')
		s = s.replace('R?', 'RB')
		s = s.replace('?B', 'RB')
		s = s.replace('B?', 'BR')
	print(s)


t = int(input())
for i in range(t):
	n = int(input())
	s = input()
	sa = 'B'
	st1 = ''
	for i in s:
		if i == 'R':
			st1 += i
			sa = 'B'
		elif i == 'B':
			st1 += i
			sa = 'R'
		else:
			st1 += sa
			if sa == 'R':
				sa = 'B'
			else:
				sa = 'R'
	sa = 'R'
	st2 = ''
	for i in s:
		if i == 'R':
			st2 += i
			sa = 'B'
		elif i == 'B':
			st2 += i
			sa = 'R'
		else:
			st2 += sa
			if sa == 'R':
				sa = 'B'
			else:
				sa = 'R'
	ans1 = 0
	ans2 = 0
	for i in range(1, n):
		if st1[i] == st1[i - 1]:
			ans1 += 1
	for i in range(1, n):
		if st2[i] == st2[i - 1]:
			ans2 += 1
	if ans1 < ans2:
		print(st1)
	else:
		print(st2)


def main():
	for _ in range(int(input())):
		_ = int(input())
		sq_row = input()
		print(solution(sq_row))

def solution(sq_row: str) -> str:
	sq_row = list(sq_row)
	back_needed = False

	def back(index):
		for j in range(index - 1, -1, -1):
			if sq_row[j] == '?':
				sq_row[j] = 'B' if sq_row[j + 1] == 'R' else 'R'
			else:
				break
	for (i, c) in enumerate(sq_row):
		if c == '?':
			if len(sq_row) == 1:
				sq_row[i] = 'B'
			elif i == 0:
				if sq_row[i + 1] != '?':
					sq_row[i] = 'B' if sq_row[i + 1] == 'R' else 'R'
					if back_needed:
						back(i)
						back_needed = False
				else:
					back_needed = True
			elif i == len(sq_row) - 1:
				if sq_row[i - 1] != '?':
					sq_row[i] = 'B' if sq_row[i - 1] == 'R' else 'R'
				else:
					back_needed = True
			elif sq_row[i - 1] != '?':
				sq_row[i] = 'B' if sq_row[i - 1] == 'R' else 'R'
				if back_needed:
					back(i)
					back_needed = False
			elif sq_row[i + 1] != '?':
				sq_row[i] = 'B' if sq_row[i + 1] == 'R' else 'R'
				if back_needed:
					back(i)
					back_needed = False
			else:
				back_needed = True
	if back_needed:
		sq_row[len(sq_row) - 1] = 'B'
		back(len(sq_row) - 1)
	return ''.join(sq_row)
main()


import sys
from functools import reduce
from collections import defaultdict, deque
import heapq
from functools import lru_cache
from copy import deepcopy
read_line = lambda : sys.stdin.readline().strip()
read_array_int = lambda : list(map(int, read_line().split()))
read_array_float = lambda : list(map(float, read_line().split()))
read_array_string = lambda : list(read_line().split())
(RED, BLUE, UNK) = ('R', 'B', '?')

def calc_imperfectness(arr):
	imperfectness = 0
	for i in range(1, len(arr)):
		if arr[i] == arr[i - 1]:
			imperfectness += 1
	return imperfectness

def solve(test_num):
	size = int(read_line())
	s1 = list(read_line())
	s2 = deepcopy(s1)
	if UNK not in s1:
		print(''.join(s1))
		return
	first = s1.index(UNK)
	s1[first] = RED
	for i in range(size):
		if s1[i] == UNK:
			if s1[i - 1] == RED:
				s1[i] = BLUE
			else:
				s1[i] = RED
	m1 = calc_imperfectness(s1)
	first = s2.index(UNK)
	s2[first] = BLUE
	for i in range(size):
		if s2[i] == UNK:
			if s2[i - 1] == RED:
				s2[i] = BLUE
			else:
				s2[i] = RED
	m2 = calc_imperfectness(s2)
	if m1 < m2:
		print(''.join(s1))
	else:
		print(''.join(s2))
t = int(read_line())
for test_case_num in range(t):
	solve(test_case_num)


def paint(ans, i, n):
	(l, r) = (i - 1, i + 1)
	if l >= 0 and ans[l] == '?':
		if ans[i] == 'B':
			ans[l] = 'R'
		else:
			ans[l] = 'B'
		paint(ans, l, n)
	if r < n and ans[r] == '?':
		if ans[i] == 'B':
			ans[r] = 'R'
		else:
			ans[r] = 'B'
		paint(ans, r, n)
for _ in range(int(input())):
	N = int(input())
	S = input()
	ans = [c for c in S]
	for i in range(N):
		if ans[i] in ('B', 'R'):
			paint(ans, i, N)
	for i in range(0, N, 2):
		if ans[i] == '?':
			ans[i] = 'B'
	for i in range(1, N, 2):
		if ans[i] == '?':
			ans[i] = 'R'
	print(''.join(ans))


import sys
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	n = int(input())
	s = list(input().rstrip())
	pivot = -1
	for i in range(n):
		if s[i] != '?':
			pivot = i
			break
	if pivot == -1:
		print('BR' * (n // 2) + 'B' * (n % 2))
		continue
	for i in range(pivot - 1, -1, -1):
		if s[i] != '?':
			continue
		elif s[i + 1] == 'R':
			s[i] = 'B'
		elif s[i + 1] == 'B':
			s[i] = 'R'
	for i in range(pivot + 1, n):
		if s[i] != '?':
			continue
		if s[i - 1] == 'R':
			s[i] = 'B'
		elif s[i - 1] == 'B':
			s[i] = 'R'
	print(''.join(s))


for _ in range(int(input())):
	n = int(input())
	s = input()
	s = list(s)
	c = s.count('?')
	if c == n:
		for i in range(n):
			if i & 1:
				print('B', end='')
			else:
				print('R', end='')
		print()
	elif 'R' in s:
		z = s.index('R')
		for i in range(z, n):
			if s[i] == '?':
				if s[i - 1] == 'R':
					s[i] = 'B'
				else:
					s[i] = 'R'
		for i in range(z, -1, -1):
			if s[i] == '?':
				if s[i + 1] == 'R':
					s[i] = 'B'
				else:
					s[i] = 'R'
		print(''.join(s))
	else:
		z = s.index('B')
		for i in range(z, n):
			if s[i] == '?':
				if s[i - 1] == 'R':
					s[i] = 'B'
				else:
					s[i] = 'R'
		for i in range(z, -1, -1):
			if s[i] == '?':
				if s[i + 1] == 'R':
					s[i] = 'B'
				else:
					s[i] = 'R'
		print(''.join(s))


t = int(input())
while t:
	n = int(input())
	s = input()
	s1 = ''
	j = n + 2
	s = list(s)
	for i in range(n):
		if s[i] != '?':
			j = i
			break
	if j < n:
		if s[j] == 'B':
			for k in range(1, j + 1):
				if k % 2 == 0:
					s[j - k] = 'B'
				else:
					s[j - k] = 'R'
		else:
			for k in range(1, j + 1):
				if k % 2 == 0:
					s[j - k] = 'R'
				else:
					s[j - k] = 'B'
		for k in range(j + 1, n):
			if s[k] == '?':
				if s[k - 1] == 'B':
					s[k] = 'R'
				else:
					s[k] = 'B'
	else:
		for i in range(n):
			if i % 2 == 0:
				s[i] = 'R'
			else:
				s[i] = 'B'
	print(''.join(s))
	t -= 1


t = int(input())
for _ in range(t):
	n = int(input())
	s = list(input())
	try:
		ir = s.index('R')
	except:
		ir = n + 1
	try:
		il = s.index('B')
	except:
		il = n + 1
	cur = (min(il, ir) + (il > ir)) % 2
	for i in range(n):
		if s[i] == '?':
			s[i] = ['B', 'R'][cur]
			cur += 1
			cur %= 2
		elif s[i] == 'R':
			cur = 0
		elif s[i] == 'B':
			cur = 1
	print(''.join(s))


t = int(input())
for i in range(t):
	n = int(input())
	s = input()
	l = list(s)
	if l[0] == '?':
		if l.count('R') == 0 and l.count('B') == 0:
			l[0] = 'R'
		elif l.count('B') == 0:
			l[0] = 'B' if l.index('R') % 2 != 0 else 'R'
		elif l.count('R') == 0:
			l[0] = 'R' if l.index('B') % 2 != 0 else 'B'
		elif l.index('R') < l.index('B'):
			l[0] = 'B' if l.index('R') % 2 != 0 else 'R'
		else:
			l[0] = 'R' if l.index('B') % 2 != 0 else 'B'
	for i in range(n - 1):
		if l[i + 1] == '?':
			l[i + 1] = 'R' if l[i] == 'B' else 'B'
	print(''.join(l))


import sys, os, io
from sys import stdin
import math
from collections import defaultdict
from heapq import heappush, heappop, heapify
from bisect import bisect_left, bisect_right
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
alphabets = list('abcdefghijklmnopqrstuvwxyz')
from types import GeneratorType

def bootstrap(f, stack=[]):

	def wrappedfunc(*args, **kwargs):
		if stack:
			return f(*args, **kwargs)
		else:
			to = f(*args, **kwargs)
			while True:
				if type(to) is GeneratorType:
					stack.append(to)
					to = next(to)
				else:
					stack.pop()
					if not stack:
						break
					to = stack[-1].send(to)
			return to
	return wrappedfunc

def ncr(n, r, p):
	num = den = 1
	for i in range(r):
		num = num * (n - i) % p
		den = den * (i + 1) % p
	return num * pow(den, p - 2, p) % p

def primeFactors(n):
	l = []
	while n % 2 == 0:
		l.append(2)
		n = n / 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			l.append(int(i))
			n = n / i
	if n > 2:
		l.append(n)
	return list(set(l))

def power(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def sieveForSmallestPrimeFactor():
	MAXN = 100001
	spf = [0 for i in range(MAXN)]
	spf[1] = 1
	for i in range(2, MAXN):
		spf[i] = i
	for i in range(4, MAXN, 2):
		spf[i] = 2
	for i in range(3, math.ceil(math.sqrt(MAXN))):
		if spf[i] == i:
			for j in range(i * i, MAXN, i):
				if spf[j] == j:
					spf[j] = i
	return spf

def getPrimeFactorizationLOGN(x):
	spf = sieveForSmallestPrimeFactor()
	ret = list()
	while x != 1:
		ret.append(spf[x])
		x = x // spf[x]
	return ret

def SieveOfEratosthenes(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	return prime

def si():
	return input()

def divideCeil(n, x):
	if n % x == 0:
		return n // x
	return n // x + 1

def ii():
	return int(input())

def li():
	return list(map(int, input().split()))
if os.path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
	input = lambda : sys.stdin.readline().rstrip('\r\n')

def solve():
	n = ii()
	s = list(si())
	res = s[:]
	res1 = s[:]
	ans = 0
	prev = 'B'
	for i in range(n):
		if s[i] == '?':
			if prev == 'B':
				res[i] = 'R'
			else:
				res[i] = 'B'
		else:
			res[i] = s[i]
		prev = res[i]
	ans = 0
	for i in range(1, n):
		if res[i] == res[i - 1]:
			ans += 1
	ans1 = ans
	res1 = res[:]
	res = s[:]
	prev = 'R'
	for i in range(n):
		if s[i] == '?':
			if prev == 'B':
				res[i] = 'R'
			else:
				res[i] = 'B'
		else:
			res[i] = s[i]
		prev = res[i]
	ans = 0
	for i in range(1, n):
		if res[i] == res[i - 1]:
			ans += 1
	if ans1 < ans:
		print(''.join(res1))
	else:
		print(''.join(res))
t = 1
t = ii()
for _ in range(t):
	solve()


import sys
input = lambda : sys.stdin.readline()
int_arr = lambda : list(map(int, input().split()))
str_arr = lambda : list(map(str, input().split()))
get_str = lambda : map(str, input().split())
get_int = lambda : map(int, input().split())
get_flo = lambda : map(float, input().split())
mod = 1000000007

def solve(n, s):
	s = list(s)
	ind = 0
	d = {'R': 'B', 'B': 'R', '?': 'B'}
	for i in range(n):
		if s[i] != '?':
			ind = i
			break
	if s[ind] == '?':
		s[ind] = d[s[ind]]
	prev = s[ind]
	for i in range(ind - 1, -1, -1):
		if s[i] == '?':
			s[i] = d[prev]
		prev = s[i]
	prev = s[ind]
	for i in range(ind + 1, n):
		if s[i] == '?':
			s[i] = d[prev]
		prev = s[i]
	print(''.join(s))
for _ in range(int(input())):
	n = int(input())
	s = str(input())[:-1]
	solve(n, s)


n = int(input())
rows = []
lens = []
for _ in range(n):
	lens.append(int(input()))
	rows.append(input())
for (index_row, row) in enumerate(rows):
	if '?' not in row:
		print(row)
		continue
	if row.count('?') == lens[index_row]:
		char = 'R'
		for i in range(lens[index_row]):
			print(char, end='')
			if char == 'R':
				char = 'B'
			else:
				char = 'R'
		print()
		continue
	index_firstColor = None
	for (index, char) in enumerate(row):
		if char != '?':
			index_firstColor = index
			break
	if index_firstColor != lens[index_row] - 1:
		for index in range(index_firstColor, lens[index_row]):
			if row[index] == '?':
				if row[index - 1] == 'B':
					row = row[:index] + 'R' + row[index + 1:]
				else:
					row = row[:index] + 'B' + row[index + 1:]
	if row[0] == '?':
		for index in range(index_firstColor, 0, -1):
			if row[index] == 'B':
				row = row[:index - 1] + 'R' + row[index:]
			else:
				row = row[:index - 1] + 'B' + row[index:]
	print(row)


from sys import stdin, stderr

def rl():
	return [int(w) for w in stdin.readline().split()]

def paint(s):
	for i in range(1, len(s)):
		if s[i] == '?' and s[i - 1] != '?':
			s[i] = 'R' if s[i - 1] == 'B' else 'B'
(t,) = rl()
for _ in range(t):
	(n,) = rl()
	s = list(stdin.readline().rstrip())
	paint(s)
	s.reverse()
	paint(s)
	s.reverse()
	if s[0] != '?':
		print(''.join(s))
	else:
		print('RB' * (len(s) // 2) + 'R' * (len(s) % 2))


T = int(input())
for t in range(T):
	N = int(input())
	arr = list(input())
	dct = {'R': 'B', 'B': 'R'}
	for i in range(N):
		if arr[i] == '?':
			if i and arr[i - 1] != '?':
				arr[i] = dct[arr[i - 1]]
	for i in range(N - 1, -1, -1):
		if arr[i] == '?':
			if i == N - 1:
				arr[i] = 'R'
			else:
				arr[i] = dct[arr[i + 1]]
	print(''.join(arr))


z = lambda : map(int, input().split())
for i in range(int(input())):
	n = int(input())
	s = list(input())
	if len(set(s)) == 1 and s[0] == '?':
		x = 'R'
		for i in range(n):
			if x == 'R':
				s[i] = 'B'
				x = 'B'
			else:
				s[i] = 'R'
				x = 'R'
	else:
		st = []
		for i in range(n):
			if s[i] == '?':
				st.append(i)
			else:
				x = s[i]
				while st:
					if x == 'B':
						s[st.pop()] = 'R'
						x = 'R'
					else:
						s[st.pop()] = 'B'
						x = 'B'
				x = s[i]
				j = i + 1
				while j < n and s[j] == '?':
					if x == 'B':
						s[j] = 'R'
						x = 'R'
					else:
						s[j] = 'B'
						x = 'B'
					j += 1
	print(''.join(s))


test = int(input())
a = ['R', 'B']
tmp = 'RB' * 100
for t in range(test):
	n = int(input())
	s = list(input())
	l = len(s)
	index = 0
	while index < l:
		if s[index] != '?':
			index += 1
			continue
		start = index
		end = index
		while end < l and s[end] == '?':
			end += 1
		end -= 1
		if s[start] == '?':
			if start == 0 and end == l - 1:
				s = tmp[start:end + 1]
			elif start == 0:
				cc = (a.index(s[end + 1]) + 1) % 2
				while end >= 0:
					s[end] = a[cc]
					end -= 1
					cc = (cc + 1) % 2
			elif s[start - 1] == 'R':
				s[start:end + 1] = tmp[1:end - start + 2]
			else:
				s[start:end + 1] = tmp[0:end - start + 1]
		index = end + 1
	print(''.join(s))


import sys
p2D = lambda x: print(*x, sep='\n')

def II():
	return int(sys.stdin.buffer.readline())

def MI():
	return map(int, sys.stdin.buffer.readline().split())

def LI():
	return list(map(int, sys.stdin.buffer.readline().split()))

def LLI(rows_number):
	return [LI() for _ in range(rows_number)]

def BI():
	return sys.stdin.buffer.readline().rstrip()

def SI():
	return sys.stdin.buffer.readline().rstrip().decode()

def li():
	return [int(i) for i in input().split()]

def lli(rows):
	return [li() for _ in range(rows)]

def si():
	return input()

def ii():
	return int(input())

def ins():
	return input().split()

def binery_search(arr, key):
	l = 0
	h = len(arr)
	while l <= h:
		mid = (l + h) // 2
		if arr[mid] > key and arr[mid - 1] <= key:
			return mid
		elif arr[mid] <= key:
			l = mid + 1
		else:
			h = mid - 1
	return -1

def solve():
	n = II()
	s = SI()
	ans = ''
	i = 0
	prev = 0
	while i < n:
		cnt = 0
		if s[i] != '?':
			ans += s[i]
			prev = s[i]
			i += 1
		while i < n and s[i] == '?':
			cnt += 1
			i += 1
		if prev == 'B':
			ans = ans + 'RB' * (cnt // 2)
			if cnt % 2:
				ans += 'R'
		elif prev == 'R':
			ans = ans + 'BR' * (cnt // 2)
			if cnt % 2:
				ans += 'B'
		elif i == n:
			ans = ans + 'BR' * (cnt // 2)
			if cnt % 2:
				ans += 'B'
		elif s[i] == 'R':
			if cnt % 2:
				ans = ans + 'BR' * (cnt // 2) + 'B'
			else:
				ans = ans + 'RB' * (cnt // 2)
		elif cnt % 2:
			ans = ans + 'RB' * (cnt // 2) + 'R'
		else:
			ans = ans + 'BR' * (cnt // 2)
	return ans

def main():
	for _ in range(II()):
		sys.stdout.write(str(solve()) + '\n')
main()


t = int(input())
for _ in range(t):
	n = int(input())
	val = list(input().strip())
	idx = -1
	for i in range(n):
		if val[i] != '?':
			idx = i
			break
	if idx == -1:
		val[0] = 'B'
	if idx != 0 and idx != -1:
		if idx & 1 == 0:
			val[0] = val[idx]
		elif val[idx] == 'R':
			val[0] = 'B'
		else:
			val[0] = 'R'
	for i in range(1, n):
		if val[i] == '?':
			if val[i - 1] == 'B':
				val[i] = 'R'
			else:
				val[i] = 'B'
	print(''.join(val))


for _ in range(int(input())):
	input()
	ss = {'': ([], 0)}
	for c in input():
		sss = {}
		for (e, (s, x)) in ss.items():
			for cc in 'RB':
				if c in (cc, '?'):
					xx = x + bool(s and s[-1] == cc)
					if cc not in sss or sss[cc][1] > xx:
						sss[cc] = (s + [cc], xx)
		ss = sss
	q = list(ss.values())
	m = min((x for (_, x) in q))
	print(''.join(next((s for (s, x) in q if x == m))))


def main():
	alpha = 'abcdefghijklmnopqrstuvwxyz'
	ALPHA = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
	inf = 1e+17
	mod = 10 ** 9 + 7

	def factorial(n):
		f = 1
		for i in range(1, n + 1):
			f = f * i % mod
		return f

	def ncr(n, r):
		num = den = 1
		for i in range(r):
			num = num * (n - i) % mod
			den = den * (i + 1) % mod
		return num * pow(den, mod - 2, mod) % mod

	def solve(n, arr):
		st = []
		ptr = 0
		answer = []
		while ptr < n:
			if arr[ptr] == '?':
				st.append('?')
			else:
				rev = [arr[ptr]]
				while st:
					if rev[-1] == 'R':
						rev.append('B')
					else:
						rev.append('R')
					st.pop()
				answer += rev[::-1]
			ptr += 1
		start = len(answer) - 1
		if start < n:
			if arr[start] == 'B':
				answer += (n - len(answer) + 1) // 2 * ['R', 'B']
			else:
				answer += (n - len(answer) + 1) // 2 * ['B', 'R']
		return ''.join(answer[:n])
		pass
	t = int(input())
	ans = []
	for _ in range(t):
		n = int(input())
		arr = list(input()[:-1])
		ans.append(solve(n, arr))
	for answer in ans:
		print(answer)
import sys, threading
import bisect
import math
import itertools
from sys import stdout
input = sys.stdin.readline
thread = threading.Thread(target=main)
thread.start()
thread.join()


import sys
from math import *
import builtins
import string
import bisect
import os
from io import BytesIO, IOBase
alphabets = list(string.ascii_lowercase)
ALPHABETS = list(string.ascii_uppercase)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self, **kwargs):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def print(x, end='\n'):
	sys.stdout.write(str(x) + end)

def get_int():
	return int(input())

def get_list_ints():
	return list(map(int, input().split()))

def get_char_list():
	s = input()
	return list(s[:len(s)])

def get_tuple_ints():
	return tuple(map(int, input().split()))

def print_iterable(p):
	print(' '.join(map(str, p)))

def floorSearch(arr, low, high, x):
	if low > high:
		return -1
	if x >= arr[high]:
		return high
	mid = int((low + high) / 2)
	if arr[mid] == x:
		return mid
	if mid > 0 and arr[mid - 1] <= x < arr[mid]:
		return mid - 1
	if x < arr[mid]:
		return floorSearch(arr, low, mid - 1, x)
	return floorSearch(arr, mid + 1, high, x)

def binary_search(arr, x):
	low = 0
	high = len(arr) - 1
	mid = 0
	while low <= high:
		mid = (high + low) // 2
		if arr[mid] < x:
			low = mid + 1
		elif arr[mid] > x:
			high = mid - 1
		else:
			return mid
	return high

def main():
	q = get_int()
	for p in range(q):
		n = get_int()
		ls = get_char_list()
		if set(ls) == {'?'}:
			for i in range(n):
				if i % 2 == 0:
					ls[i] = 'R'
				else:
					ls[i] = 'B'
		else:
			t = 0
			while ls[t] == '?':
				t += 1
			if ls[t] == 'R':
				if t % 2 == 0:
					ls[0] = 'R'
				else:
					ls[0] = 'B'
			elif t % 2 == 0:
				ls[0] = 'B'
			else:
				ls[0] = 'R'
			for i in range(n):
				if ls[i] == '?':
					if ls[i - 1] == 'B':
						ls[i] = 'R'
					else:
						ls[i] = 'B'
		s = ''.join((y for y in ls))
		print(s)
	pass
main()


t = int(input())
for i in range(t):
	n = int(input())
	s = list(input())
	if s.count('?') == n:
		ans = ''
		for i in range(n):
			if i % 2 == 0:
				ans = ans + 'B'
			else:
				ans = ans + 'R'
		print(ans)
		continue
	for i in range(n):
		if s[i] != '?':
			j = i - 1
			while j >= 0 and s[j] == '?':
				if abs(j - i) % 2 == 0:
					s[j] = s[i]
				elif s[i] == 'B':
					s[j] = 'R'
				else:
					s[j] = 'B'
				j = j - 1
			j = i + 1
			while j < n and s[j] == '?':
				if abs(j - i) % 2 == 0:
					s[j] = s[i]
				elif s[i] == 'B':
					s[j] = 'R'
				else:
					s[j] = 'B'
				j = j + 1
	ans = ''
	for i in range(n):
		ans = ans + s[i]
	print(ans)


for _ in range(int(input())):
	a = 0
	n = int(input())
	a += 1
	s = list(input())
	a += 1
	if s.count('B') == 0 and s.count('R') == 0:
		p = ''
		a += 1
		for i in range(n):
			if i % 2 == 0:
				p += 'R'
			else:
				p += 'B'
		print(p)
		a += 1
		a += 1
		a += 1
	else:
		a += 1
		a += 1
		a + +1
		while 1:
			c = 0
			a += 1
			for i in range(n):
				if s[i] == 'R':
					if i != n - 1 and s[i + 1] == '?':
						s[i + 1] = 'B'
						c += 1
					if i != 0 and s[i - 1] == '?':
						s[i - 1] = 'B'
						c += 1
				elif s[i] == 'B':
					if i != n - 1 and s[i + 1] == '?':
						s[i + 1] = 'R'
						c += 1
					if i != 0 and s[i - 1] == '?':
						s[i - 1] = 'R'
						c += 1
			if c == 0:
				break
			a += 1
		a += 1
		a += 1
		print(''.join(s))
		a += 1
		a += 1
		a += 1
		a += 1


t = int(input())
for _ in range(t):
	n = int(input())
	s = input()
	s = 'G' + s + 'G'
	a = list(s)
	c = 0
	for i in range(n + 1):
		if a[i] != '?' and a[i] != 'G':
			c = i
			break
	if a[c] == 'R':
		if c % 2 == 0:
			a[1] = 'B'
		else:
			a[1] = 'R'
	elif a[c] == 'B':
		if c % 2 == 0:
			a[1] = 'R'
		else:
			a[1] = 'B'
	for i in range(1, n + 1):
		if a[i] == '?':
			if a[i + 1] == 'R':
				a[i] = 'B'
			elif a[i + 1] == 'B':
				a[i] = 'R'
			elif a[i - 1] == 'R':
				a[i] = 'B'
			else:
				a[i] = 'R'
	print(*a[1:len(a) - 1], sep='')


from sys import stdin
from collections import deque, Counter, defaultdict, OrderedDict
import sys
import math, os
import operator
import random
from fractions import Fraction
import functools
import bisect
import itertools
from heapq import *
import time
import copy
import sys
input = lambda : sys.stdin.readline().rstrip()

class SegmentTree:

	def __init__(self, init, unitX, f):
		self.f = f
		self.unitX = unitX
		self.f = f
		if type(init) == int:
			self.n = init
			self.n = 1 << (self.n - 1).bit_length()
			self.X = [unitX] * (self.n * 2)
		else:
			self.n = len(init)
			self.n = 1 << (self.n - 1).bit_length()
			self.X = [unitX] * self.n + init + [unitX] * (self.n - len(init))
			for i in range(self.n - 1, 0, -1):
				self.X[i] = self.f(self.X[i * 2], self.X[i * 2 | 1])

	def update(self, i, x):
		i += self.n
		self.X[i] = x
		i >>= 1
		while i:
			self.X[i] = self.f(self.X[i * 2], self.X[i * 2 | 1])
			i >>= 1

	def getvalue(self, i):
		return self.X[i + self.n]

	def getrange(self, l, r):
		l += self.n
		r += self.n
		al = self.unitX
		ar = self.unitX
		while l < r:
			if l & 1:
				al = self.f(al, self.X[l])
				l += 1
			if r & 1:
				r -= 1
				ar = self.f(self.X[r], ar)
			l >>= 1
			r >>= 1
		return self.f(al, ar)

	def max_right(self, l, z):
		if l >= self.n:
			return self.n
		l += self.n
		s = self.unitX
		while 1:
			while l % 2 == 0:
				l >>= 1
			if not z(self.f(s, self.X[l])):
				while l < self.n:
					l *= 2
					if z(self.f(s, self.X[l])):
						s = self.f(s, self.X[l])
						l += 1
				return l - self.n
			s = self.f(s, self.X[l])
			l += 1
			if l & -l == l:
				break
		return self.n

	def min_left(self, r, z):
		if r <= 0:
			return 0
		r += self.n
		s = self.unitX
		while 1:
			r -= 1
			while r > 1 and r % 2:
				r >>= 1
			if not z(self.f(self.X[r], s)):
				while r < self.n:
					r = r * 2 + 1
					if z(self.f(self.X[r], s)):
						s = self.f(self.X[r], s)
						r -= 1
				return r + 1 - self.n
			s = self.f(self.X[r], s)
			if r & -r == r:
				break
		return 0

	def debug(self):
		print('debug')
		print([self.getvalue(i) for i in range(min(self.n, 20))])
for _ in range(int(input())):
	n = int(input())
	s = list(input())
	nq = n - s.count('?')
	d = {'R': 'B', 'B': 'R'}
	if not nq:
		s[0] = 'R'
	for i in range(1, n):
		if s[i] == '?' and s[i - 1] != '?':
			s[i] = d[s[i - 1]]
	for i in range(n - 2, -1, -1):
		if s[i] == '?' and s[i + 1] != '?':
			s[i] = d[s[i + 1]]
	print(''.join(s))


def RedBlue(a):
	if len(a) == 1:
		if a[0] == 'R' or a[0] == 'B':
			ass = ''.join(map(str, a))
			return ass
		else:
			a[0] = 'R'
			ass = ''.join(map(str, a))
			return ass
	l = len(a)
	count = 0
	for i in range(0, len(a)):
		if a[i] == '?':
			count = count + 1
	if count == l:
		for i in range(0, len(a)):
			if a[i - 1] == 'R':
				a[i] = 'B'
			else:
				a[i] = 'R'
	s1 = s2 = 0
	for i in range(0, len(a)):
		if a[i] == 'R':
			s1 = i
			break
		elif a[i] == 'B':
			s2 = i
			break
	if s2 != 0:
		for i in range(s2 - 1, -1, -1):
			if a[i + 1] == 'R':
				a[i] = 'B'
			else:
				a[i] = 'R'
	else:
		for i in range(s1 - 1, -1, -1):
			if a[i + 1] == 'R':
				a[i] = 'B'
			else:
				a[i] = 'R'
	for i in range(0, len(a)):
		if a[i] == '?':
			if a[i - 1] == 'B':
				a[i] = 'R'
			elif a[i - 1] == 'R':
				a[i] = 'B'
	atostr = ''.join(map(str, a))
	return atostr
t = int(input())
z = []
for i in range(t):
	s = int(input())
	a = input()
	a = list(a)
	ss = RedBlue(a)
	z.append(ss)
for q in range(0, len(z)):
	print(z[q])


import sys
import math
import re
from collections import Counter
from bisect import bisect_left

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6

def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)

def maxSubArraySum(a, size):
	max_so_far = a[0]
	curr_max = a[0]
	for i in range(1, size):
		curr_max = max(a[i], curr_max + a[i])
		max_so_far = max(max_so_far, curr_max)
	return max_so_far
t = int(input())
mod = pow(10, 9) + 7
while t > 0:
	n = int(input())
	s = input()
	l = []
	for i in range(n):
		l.append(s[i])
	if n == 1:
		if l[0] == '?':
			print('B')
		else:
			print(s)
	else:
		i = 0
		while i < n:
			if l[i] != '?':
				for j in range(i - 1, -1, -1):
					if l[j] == '?':
						if l[j + 1] == 'B':
							l[j] = 'R'
						else:
							l[j] = 'B'
					else:
						break
				i += 1
			else:
				i += 1
		if '?' in l:
			if l[0] == '?':
				s1 = 'BR' * (n // 2)
				if n % 2 == 0:
					print(s1)
				else:
					print(s1 + 'B')
			else:
				for i in range(n):
					if l[i] == '?':
						if l[i - 1] == 'B':
							l[i] = 'R'
						else:
							l[i] = 'B'
				print(''.join(l))
		else:
			print(''.join(l))
	t -= 1


for _ in range(int(input())):
	n = int(input())
	s = input()
	i = 0
	ans = []
	while i < n:
		while i < n and s[i] != '?':
			ans.append(s[i])
			i += 1
		b = 'something'
		if i != 0:
			b = s[i - 1]
		l = 0
		while i < n and s[i] == '?':
			i += 1
			l += 1
		if i < n and s[i] == 'B':
			if l % 2:
				ans.append('RB' * (l // 2) + 'R')
			else:
				ans.append('BR' * (l // 2))
		elif i < n:
			if l % 2:
				ans.append('BR' * (l // 2) + 'B')
			else:
				ans.append('RB' * (l // 2))
		elif b == 'B':
			ans.append('RB' * (l // 2) + 'R' * (l % 2))
		else:
			ans.append('BR' * (l // 2) + 'B' * (l % 2))
	print(''.join(ans))


t = int(input())
for i in range(t):
	n = int(input())
	s = input()
	s1 = s
	d = 0
	x = 'R'
	for i in range(len(s)):
		if s[i] == '?':
			s = s.replace('?', x, 1)
		elif s[i] == x:
			d = d + 1
		else:
			x = s[i]
		if x == 'R':
			x = 'B'
		else:
			x = 'R'
	d1 = 0
	x = 'B'
	for i in range(len(s)):
		if s1[i] == '?':
			s1 = s1.replace('?', x, 1)
		elif s1[i] == x:
			d1 = d1 + 1
		else:
			x = s1[i]
		if x == 'R':
			x = 'B'
		else:
			x = 'R'
	if d > d1:
		print(s)
	else:
		print(s1)


import re

def fill(n, s0):
	if s0 == 'B':
		return 'RB' * (n // 2) + 'R' * (n % 2)
	else:
		return 'BR' * (n // 2) + 'B' * (n % 2)
inverse = {'B': 'R', 'R': 'B'}
t = int(input())
out = []
for _ in range(t):
	n = int(input())
	s = input()
	s = re.split('(B|R)', s)
	s = [i for i in s if i != '']
	if s[0][0] == '?':
		try:
			if len(s[0]) % 2 == 1:
				s[0] = fill(len(s[0]), s[1])
			else:
				s[0] = fill(len(s[0]), inverse[s[1]])
		except:
			s[0] = fill(len(s[0]), 'B')
	for i in range(1, len(s)):
		if s[i][0] == '?':
			s[i] = fill(len(s[i]), s[i - 1])
	print(''.join(s))


p = int(input())
zn = ['R', 'B']
for _ in range(p):
	pod = 0
	n = int(input())
	s = list(input())
	s.append('R')
	if s[pod] == '?':
		while s[pod] == '?':
			pod += 1
		s[0] = zn[zn.index(s[pod]) - pod % 2]
	s.pop()
	for i in range(1, n):
		if s[i] == '?':
			s[i] = zn[zn.index(s[i - 1]) - 1]
	print(*s, sep='')


t = int(input())
for _ in range(t):
	n = int(input())
	string = input()
	i = 0
	res = ''
	while i < n and string[i] == '?':
		i += 1
	if i < n:
		end = string[i]
	else:
		print('BR' * (i // 2) + 'B' * (i % 2))
		continue
	temp = i
	while i > 0:
		i -= 1
		end = 'R' if end == 'B' else 'B'
		res = end + res
	i = temp
	while i < n:
		if string[i] != '?':
			end = string[i]
		res += end
		end = 'R' if end == 'B' else 'B'
		i += 1
	print(res)


for i in range(int(input())):
	n = int(input())
	s = input()
	ans = ''
	d = {'B': 'R', 'R': 'B'}
	for j in range(n):
		if s[j] != '?':
			ans += s[j]
		elif j == 0:
			h = '.'
			o = 0
			for k in range(n):
				if s[k] != '?':
					h = s[k]
					o = k
					break
			if h == '.':
				ans += 'B'
			elif o % 2 != 0:
				ans += d[h]
			else:
				ans += h
		else:
			ans += d[ans[-1]]
	print(ans)


import sys
import math
t = int(sys.stdin.readline())
for _ in range(t):
	n = int(sys.stdin.readline())
	line = sys.stdin.readline()
	if 'B' not in line and 'R' not in line:
		print(('BR' * (n // 2 + 1))[:n])
		continue
	ans = [' '] * n
	for i in range(n):
		if line[i] != '?':
			ans[i] = line[i]
		if line[i] == '?':
			if i == 0:
				continue
			if ans[i - 1] == 'R':
				ans[i] = 'B'
			if ans[i - 1] == 'B':
				ans[i] = 'R'
	for i in range(n - 2, -1, -1):
		if ans[i] == ' ':
			if ans[i + 1] == 'R':
				ans[i] = 'B'
			if ans[i + 1] == 'B':
				ans[i] = 'R'
	print(''.join(ans))