Alice has a grid with $2$ rows and $n$ columns. She fully covers the grid using $n$ dominoes of size $1 \times 2$ — Alice may place them vertically or horizontally, and each cell should be covered by exactly one domino.

Now, she decided to show one row of the grid to Bob. Help Bob and figure out what the other row of the grid looks like!


-----Input-----

The input consists of multiple test cases. The first line contains an integer $t$ ($1 \leq t \leq 5000$) — the number of test cases. The description of the test cases follows.

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

The second line of each test case contains a string $s$ consisting of $n$ characters, each of which is either L, R, U, or D, representing the left, right, top, or bottom half of a domino, respectively (see notes for better understanding). This string represents one of the rows of the grid.

Additional constraint on the input: each input corresponds to at least one valid tiling.


-----Output-----

For each test case, output one string — the other row of the grid, using the same format as the input string. If there are multiple answers, print any.


-----Examples-----

Input
4
1
U
2
LR
5
LRDLR
6
UUUUUU
Output
D
LR
LRULR
DDDDDD


-----Note-----

In the first test case, Alice shows Bob the top row, the whole grid may look like:

In the second test case, Alice shows Bob the bottom row, the whole grid may look like:

In the third test case, Alice shows Bob the bottom row, the whole grid may look like:

In the fourth test case, Alice shows Bob the top row, the whole grid may look like:

Difficulty: EASY
Tags: String algorithms

Implementation

Starter code:

Solutions:
print(''.join([*open(0)][2::2]).translate({85: 68, 68: 85, 10: 10}))


for g in [*open(0)][2::2]:
	print(g.replace('U', 'T').replace('D', 'U').replace('T', 'D').strip())


n = int(input())
y = []
for i in range(n):
	x1 = int(input())
	s = input()
	if 'U' in s:
		x = s.replace('U', 'D')
		y.append(x)
	elif 'D' in s:
		x = s.replace('D', 'U')
		y.append(x)
	else:
		y.append(s)
for j in y:
	print(j)


num = int(input())
area = []
for i in range(num):
	(number, letter) = (int(input()), input())
	area.append(letter)
new_area = []
for line in area:
	if 'U' in line:
		new_area.append(line.replace('U', 'D'))
	elif 'D' in line:
		new_area.append(line.replace('D', 'U'))
	else:
		new_area.append(line)
print(*new_area, sep='\n')


t = int(input())
l = []
l1 = []
for i in range(t):
	n = int(input())
	s = input()
	l.append(s)
for ele in l:
	if 'U' in ele:
		l1.append(ele.replace('U', 'D'))
	elif 'D' in ele:
		l1.append(ele.replace('D', 'U'))
	else:
		l1.append(ele)
for elee in l1:
	print(elee)


a = int(input())
l = []
for i in range(a):
	b = int(input())
	c = str(input())
	if 'D' in c:
		d = c.replace('D', 'U')
	elif 'U' in c:
		d = c.replace('U', 'D')
	else:
		d = c
	l.append(d)
for i in l:
	print(i)


(*t,) = range(86)
t[68] = 85
t[85] = 68
print(''.join([*open(0)][2::2]).translate(t))


t = int(input())
ans = []
for _ in range(t):
	n = int(input())
	s = input()
	rel = s
	if s.count('U'):
		rel = s.replace('U', 'D')
	elif s.count('D'):
		rel = s.replace('D', 'U')
	ans.append(rel)
print('\n'.join(ans))


cases = int(input())
strings_nums = [input() for i in range(cases * 2)]
only_strings = [strings_nums[i] for i in range(len(strings_nums)) if i % 2 != 0]

def string_completion(string_list):
	change_u = [*map(lambda x: x.replace('U', 'X'), string_list)]
	change_d = [*map(lambda x: x.replace('D', 'Y'), change_u)]
	change_x = [*map(lambda x: x.replace('X', 'D'), change_d)]
	change_y = [*map(lambda x: x.replace('Y', 'U'), change_x)]
	for i in change_y:
		print(i)
string_completion(only_strings)


tests_n = int(input())
for test in range(0, tests_n):
	n = int(input())
	row_1 = input()
	row_2 = row_1.replace('U', 'F').replace('D', 'U').replace('F', 'D')
	print(row_2)


for _ in range(int(input())):
	n = int(input())
	s = input()
	print(s.replace('D', 'a').replace('U', 'D').replace('a', 'U'))


for t in range(int(input())):
	n = int(input())
	s = input()
	if 'U' in s:
		print(s.replace('U', 'D'))
	elif 'D' in s:
		print(s.replace('D', 'U'))
	else:
		print(s)


for _ in range(int(input())):
	n = int(input())
	s = str(input())
	if s.__contains__('U'):
		s = s.replace('U', 'D')
	elif s.__contains__('D'):
		s = s.replace('D', 'U')
	print(s)


for _ in range(int(input())):
	n = int(input())
	s = input()
	assert len(s) == n
	if 'U' in s:
		print(s.replace('U', 'D'))
	else:
		print(s.replace('D', 'U'))


import math
t = int(input())
for _ in range(t):
	n = int(input())
	s = input()
	r = ''
	if 'U' in s:
		s = s.replace('U', 'D')
	else:
		s = s.replace('D', 'U')
	print(s)


for _ in range(int(input())):
	n = int(input())
	s = input()
	print(s.translate({85: 68, 68: 85}))


for i in range(int(input())):
	n = int(input())
	a = input()
	a = a.replace('D', 'z')
	a = a.replace('U', 'D')
	a = a.replace('z', 'U')
	print(a)


for i in range(int(input())):
	n = int(input())
	s = input()
	if 'U' in s:
		print(s.replace('U', 'D'))
	if 'D' in s:
		print(s.replace('D', 'U'))
	if 'U' not in s and 'D' not in s:
		print(s)


for t in range(int(input())):
	input()
	grid = input()
	grid = grid.replace('U', 'A')
	grid = grid.replace('D', 'U')
	grid = grid.replace('A', 'D')
	print(grid)


for i in range(int(input())):
	j = input()
	k = input()
	r = k.replace('U', 'd')
	s = r.replace('D', 'u')
	print(s.upper())


def main():
	tests = int(input())
	for _ in range(tests):
		n = int(input())
		s = input()
		if s.__contains__('D'):
			print(s.replace('D', 'U'))
		else:
			print(s.replace('U', 'D'))
main()


t = int(input())
for _ in range(t):
	t = int(input())
	s = input()
	if 'U' in s:
		s = s.replace('U', 'D')
	else:
		s = s.replace('D', 'U')
	print(s)


x = int(input())
for i in range(x):
	f = int(input())
	k = str(input())
	if 'U' in k:
		l = k.replace('U', 'D')
	else:
		l = k.replace('D', 'U')
	print(l)


n = int(input())
for i in range(n):
	l = int(input())
	s = input()
	if 'U' in s:
		print(s.replace('U', 'D'))
	else:
		print(s.replace('D', 'U'))


n = int(input())
ans = []
for i in range(n):
	m = int(input())
	txt = input()
	txt = txt.replace('U', '+')
	txt = txt.replace('D', 'U')
	txt = txt.replace('+', 'D')
	ans.append(txt)
for i in ans:
	print(i)


T = int(input())
for i in range(T):
	n = int(input())
	s = input()
	if 'U' in s:
		s = s.replace('U', 'D')
		print(s)
	elif 'D' in s:
		s = s.replace('D', 'U')
		print(s)
	else:
		print(s)


a = int(input())
i = 0
inn = 'DU'
out = 'UD'
while i < a:
	word = input()
	ans = input()
	tran = ans.maketrans(inn, out)
	print(ans.translate(tran))
	i += 1


x = int(input())
for i in range(x):
	y = int(input())
	s = input()
	if s.find('U') >= 0:
		s = s.replace('U', 'D')
		print(s)
	elif s.find('D') >= 0:
		s = s.replace('D', 'U')
		print(s)
	else:
		print(s)


for i in range(int(input())):
	input()
	ans = input().replace('U', 'Q')
	ans = ans.replace('D', 'U')
	ans = ans.replace('Q', 'D')
	print(ans)


for __ in range(int(input())):
	(n, s) = (int(input()), input())
	print(s.replace('U', 'd').replace('D', 'u').replace('d', 'D').replace('u', 'U'))


for i in range(int(input())):
	n = int(input())
	s = input()
	x = s.replace('U', 'X').replace('D', 'U').replace('X', 'D')
	print(x)


p = int(input())
for i in range(p):
	n = int(input())
	a = input()
	if 'U' in a:
		print(a.replace('U', 'D'))
	elif 'D' in a:
		print(a.replace('D', 'U'))
	else:
		print(a)


for i in range(int(input())):
	n = int(input())
	print(input().replace('U', '_').replace('D', 'U').replace('_', 'D'))


t = int(input())
for i in range(0, t):
	dump = int(input())
	string = input()
	if string.find('U') >= 0:
		string = string.replace('U', 'D')
	elif string.find('D') >= 0:
		string = string.replace('D', 'U')
	print(string)


for _ in range(int(input())):
	n = int(input())
	s = input()
	w = s.replace('D', 'T').replace('U', 'D').replace('T', 'U')
	print(w)


for x in range(0, int(input())):
	n = int(input())
	st = input()
	if 'U' in st:
		st = st.replace('U', 'D')
	elif 'D' in st:
		st = st.replace('D', 'U')
	print(st)


d = {'U': 'D', 'D': 'U', 'L': 'L', 'R': 'R'}
for s in [*open(0)][2::2]:
	print(''.join([d[x] for x in s[:-1]]))


n = int(input())
for i in range(n):
	t = int(input())
	s = input()
	x = {'U': 'D', 'D': 'U'}
	tbl = s.maketrans(x)
	print(s.translate(tbl))


for _ in range(int(input())):
	width = int(input())
	s = input()
	if 'U' in s:
		s = s.replace('U', 'D')
	elif 'D' in s:
		s = s.replace('D', 'U')
	print(s)


n = int(input())
for i in range(n):
	A = int(input())
	S = input()
	A = S.count('U')
	B = S.count('D')
	if A > 0 and B == 0:
		F = S.replace('U', 'D')
	elif A == 0 and B > 0:
		F = S.replace('D', 'U')
	elif A == 0 and B == 0:
		F = S
	elif A > 0 and B > 0:
		T = S.replace('U', 'O')
		W = T.replace('D', 'U')
		F = W.replace('O', 'D')
	print(F)


for _ in range(int(input())):
	input()
	n = input()
	if 'U' in n:
		print(n.replace('U', 'D'))
	elif 'D' in n:
		print(n.replace('D', 'U'))
	else:
		print(n)


for _ in range(int(input())):
	input()
	print(input().translate({68: 85, 85: 68}))


T = int(input())
for _ in range(T):
	(n, s) = (int(input()), input())
	print(s.replace('U', 'D')) if 'U' in s else print(s.replace('D', 'U'))


import sys
sys.setrecursionlimit(10 ** 8)
for _ in range(int(input())):
	input()
	print(input().replace('U', 'd').replace('D', 'U').replace('d', 'D'))


for _ in range(int(input())):
	input()
	board = input()
	if 'D' in board:
		print(board.replace('D', 'U'))
	else:
		print(board.replace('U', 'D'))


t = input()
k = 0
while k != int(t):
	n = input()
	m = input()
	m = m.replace('U', 'x')
	m = m.replace('D', 'U')
	m = m.replace('x', 'D')
	k = k + 1
	print(m)


read_list = lambda : list(map(int, input().split()))

def main():
	for _ in range(int(input())):
		n = int(input())
		string = input()
		if 'D' in string:
			print(string.replace('D', 'U'))
		else:
			print(string.replace('U', 'D'))
main()


for no in range(int(input())):
	input()
	print(input().replace('U', 'X').replace('D', 'U').replace('X', 'D'))


a = input()
for i in range(int(a)):
	input()
	str1 = input()
	if str1.find('U') != -1:
		str1 = str1.replace('U', 'D')
	elif str1.find('D') != -1:
		str1 = str1.replace('D', 'U')
	print(str1)


for i in range(int(input())):
	input()
	print(input().translate(str.maketrans('UD', 'DU')))


t = int(input())
for i in range(t):
	n = int(input())
	word = input()
	word = word.replace('U', 'u')
	word = word.replace('D', 'd')
	word = word.replace('u', 'D')
	word = word.replace('d', 'U')
	print(word)


def solve():
	n = int(input())
	a = input()
	b = ''
	w = {'U': 'D', 'D': 'U', 'L': 'L', 'R': 'R'}
	for i in a:
		b += w[i]
	return b
t = int(input())
ans = []
while t:
	ans.append(str(solve()))
	t -= 1
print('\n'.join(ans))


t = int(input())
for i in range(t):
	n = int(input())
	s = input()
	if s.find('U') == -1:
		print(s.replace('D', 'U'))
	else:
		print(s.replace('U', 'D'))


nbt = int(input())
for t in range(nbt):
	n = input()
	s = input()
	s = s.replace('U', 'X').replace('D', 'U').replace('X', 'D')
	print(s)


import sys
input = lambda : sys.stdin.readline().rstrip('\r\n')
t = int(input())
d_dict = {'U': 'D', 'D': 'U', 'L': 'L', 'R': 'R'}
for _ in range(t):
	n = int(input())
	s = input()
	res = [d_dict[c] for c in s]
	print(''.join(res))


s = int(input())
for i in range(s):
	x = int(input())
	y = input()
	if 'U' in y:
		z = y.replace('U', 'D')
	else:
		z = y.replace('D', 'U')
	print(z)


n = int(input())
for i in range(n):
	l = []
	for j in range(2):
		x = input()
		try:
			l.append(int(x))
		except ValueError:
			l.append(x)
	s = l[1]
	if not ('U' in s or 'D' in s):
		print(s)
	elif 'U' in s:
		print(s.replace('U', 'D'))
	else:
		print(s.replace('D', 'U'))


class Solution:

	def find(self, string: str) -> str:
		another = ''
		for i in string:
			if i in 'LR':
				another += i
			elif i == 'U':
				another += 'D'
			else:
				another += 'U'
		return another
t = int(input())
for i in range(t):
	n = int(input())
	print(Solution().find(input()))


def domino(str):
	str1 = ''
	for i in str:
		if i in 'LR':
			str1 += i
		elif i in 'D':
			str1 += 'U'
		else:
			str1 += 'D'
	return str1
t = int(input())
for i in range(t):
	n = int(input())
	print(domino(input()))