You have an $n \times n$ chessboard and $k$ rooks. Rows of this chessboard are numbered by integers from $1$ to $n$ from top to bottom and columns of this chessboard are numbered by integers from $1$ to $n$ from left to right. The cell $(x, y)$ is the cell on the intersection of row $x$ and collumn $y$ for $1 \leq x \leq n$ and $1 \leq y \leq n$.

The arrangement of rooks on this board is called good, if no rook is beaten by another rook.

A rook beats all the rooks that shares the same row or collumn with it.

The good arrangement of rooks on this board is called not stable, if it is possible to move one rook to the adjacent cell so arrangement becomes not good. Otherwise, the good arrangement is stable. Here, adjacent cells are the cells that share a side.

Such arrangement of $3$ rooks on the $4 \times 4$ chessboard is good, but it is not stable: the rook from $(1, 1)$ can be moved to the adjacent cell $(2, 1)$ and rooks on cells $(2, 1)$ and $(2, 4)$ will beat each other.

Please, find any stable arrangement of $k$ rooks on the $n \times n$ chessboard or report that there is no such arrangement.


-----Input-----

The first line contains a single integer $t$ ($1 \leq t \leq 100$) — the number of test cases.

The first line of each test case contains two integers $n$, $k$ ($1 \leq k \leq n \leq 40$) — the size of the chessboard and the number of rooks.


-----Output-----

If there is a stable arrangement of $k$ rooks on the $n \times n$ chessboard, output $n$ lines of symbols . and R. The $j$-th symbol of the $i$-th line should be equals R if and only if there is a rook on the cell $(i, j)$ in your arrangement.

If there are multiple solutions, you may output any of them.

If there is no stable arrangement, output $-1$.


-----Examples-----

Input
5
3 2
3 3
1 1
5 2
40 33
Output
..R
...
R..
-1
R
.....
R....
.....
....R
.....
-1


-----Note-----

In the first test case, you should find stable arrangement of $2$ rooks on the $3 \times 3$ chessboard. Placing them in cells $(3, 1)$ and $(1, 3)$ gives stable arrangement.

In the second test case it can be shown that it is impossbile to place $3$ rooks on the $3 \times 3$ chessboard to get stable arrangement.

Difficulty: EASY
Tags: Constructive algorithms

Starter code:

Solutions:
import math
for query in range(int(input())):
	(m, r) = map(int, input().split())
	if r <= math.ceil(m / 2):
		mat = [['.'] * m for _ in range(m)]
		for i in range(r):
			mat[2 * i][2 * i] = 'R'
		print(*[''.join(r) for r in mat], sep='\n')
	else:
		print(-1)


t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	if n < 2 * k - 1:
		print(-1)
	else:
		a = 1
		b = 0
		c = n - 1
		i = 0
		for i in range(n):
			if i % 2 == 0 and k > 0:
				print(b * '.' + 'R' + c * '.')
				a += 2
				b += 2
				c -= 2
				k -= 1
			else:
				print('.' * n)
			i += 1


problem_num = int(input())
for problem in range(problem_num):
	(n, k) = map(int, input().split())
	if n // 2 + n % 2 < k:
		print(-1)
	else:
		num_rook = 0
		for i in range(n):
			if i % 2 == 0 and num_rook < k:
				print_ln = '.' * i + 'R' + '.' * (n - i - 1)
				num_rook += 1
				print(print_ln)
			else:
				print_ln = '.' * n
				print(print_ln)


for _ in range(int(input())):
	a = list(map(int, input().split()))
	n = a[0]
	k = a[1]
	sum = 0
	if (n + 1) // 2 > k - 1:
		for i in range(n // 2):
			if sum == k:
				print('.' * n)
				print('.' * n)
			else:
				print('.' * (i * 2), 'R', '.' * (n - 1 - i * 2), sep='')
				sum += 1
				print('.' * n)
		if sum == k and n % 2 == 1:
			print('.' * n)
		elif n % 2 == 1:
			print('.' * (n - 1), 'R', sep='')
	else:
		print('-1')


n = int(input())
l = []
st = []
for i in range(n):
	l.append(list(map(int, input().split())))
	x = 1 + 2 * (l[i][1] - 1)
	y = l[i][0]
	if y < x:
		st.append(-1)
	else:
		for j in range(y):
			s = '.' * y
			if j % 2 == 0 and j < x:
				s = s[0:j] + 'R' + s[j + 1:]
			st.append(s)
for k in range(len(st)):
	print(st[k])


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	done = 0
	if n >= 2 * k - 1:
		r = ['.' for i in range(n)]
		num = 0
		for i in range(n):
			if i % 2 == 1 or done >= k:
				print(''.join(r))
			else:
				r[i] = 'R'
				print(''.join(r))
				r[i] = '.'
				done += 1
	else:
		print(-1)


import sys

def solve():
	inp = sys.stdin.readline
	(n, k) = map(int, inp().split())
	a = [['.'] * n for i in range(n)]
	for i in range(k):
		if i * 2 >= n:
			print(-1)
			return
		a[i * 2][i * 2] = 'R'
	print('\n'.join((''.join(i) for i in a)))

def main():
	for i in range(int(sys.stdin.readline())):
		solve()
main()


import sys, bisect, math
from collections import deque, Counter
input = lambda : sys.stdin.readline().strip()
ceil = lambda x: math.ceil(x)
mod = 10 ** 9 + 7

def solve():
	(n, k) = map(int, input().split())
	if k > ceil(n / 2):
		return -1
	a = []
	for i in range(n):
		a.append(list('.' * n))
	for i in range(k):
		a[2 * i][2 * i] = 'R'
	s = '\n'.join([''.join(a[i]) for i in range(n)])
	return s
t = 1
t = int(input())
for _ in range(t):
	print(solve())


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	(q, r) = divmod(n, 2)
	if r:
		q += 1
	if k > q:
		print(-1)
	else:
		ans = [['.'] * n for i in range(n)]
		for i in range(0, 2 * k, 2):
			ans[i][i] = 'R'
		for line in ans:
			print(''.join(line))


for t in range(int(input())):
	(n, k) = map(int, input().split())
	if k > (n + 1) // 2:
		print(-1)
		continue
	x = []
	(a, b) = (0, 0)
	for i in range(n):
		x.append(['.'] * n)
	for i in range(k):
		x[a][b] = 'R'
		(a, b) = (a + 2, b + 2)
	for i in range(n):
		x[i] = ''.join(x[i])
	for i in range(n):
		print(x[i])


from math import ceil
t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	limit = ceil(n / 2)
	if k > limit:
		print(-1)
	else:
		board = [['.'] * n for i in range(n)]
		for i in range(0, n, 2):
			if k == 0:
				break
			board[i][i] = 'R'
			k -= 1
		board = [''.join(el) for el in board]
		for el in board:
			print(el)


import sys
input = sys.stdin.readline
num_test_cases = int(input())
for test_case_ittr in range(num_test_cases):
	(side_length, num_rooks) = [int(x) for x in input().split()]
	num_rooks_that_can_fit = (side_length + 1) // 2
	if num_rooks_that_can_fit < num_rooks:
		print(-1)
		continue
	board = [['.' for j in range(side_length)] for i in range(side_length)]
	for i in range(num_rooks):
		board[2 * i][2 * i] = 'R'
	for row in board:
		print(''.join(row))


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	if k > (n + 1) // 2:
		print(-1)
	else:
		ans = [['.'] * n for i in range(n)]
		for i in range(k):
			ans[2 * i][2 * i] = 'R'
		for i in range(n):
			ll = ''.join(ans[i])
			print(ll)


import sys
from math import sqrt, gcd
from collections import deque
sys.setrecursionlimit(10 ** 8)
I = lambda : int(input())
S = lambda : input().strip()
M = lambda : map(int, input().strip().split())
L = lambda : list(map(int, input().strip().split()))
mod = 1000000007
for i in range(I()):
	(n, k) = M()
	if n % 2 and k > n // 2 + 1:
		print(-1)
	elif n % 2 == 0 and k > n // 2:
		print(-1)
	else:
		arr = ['.'] * n
		i = 0
		while i < n:
			if k > 0:
				arr[i] = 'R'
				print(''.join(arr))
				arr[i] = '.'
				i += 1
				k -= 1
			if i < n:
				print(''.join(arr))
				i += 1


T = int(input())
for t in range(T):
	(n, k) = map(int, input().split())
	if (n + 1) // 2 < k:
		print(-1)
	else:
		grid = []
		for i in range(n):
			grid.append(['.'] * n)
		for i in range(k):
			grid[i * 2][i * 2] = 'R'
		for i in grid:
			print(''.join(i))


from math import ceil
for _ in range(int(input())):
	(n, k) = map(int, input().strip().split())
	if ceil(n / 2) < k:
		print('-1')
		continue
	mat = [['.' for _ in range(n)] for _ in range(n)]
	r = 0
	for _ in range(k):
		mat[r][r] = 'R'
		r += 2
	for row in mat:
		print(''.join(row))


import sys
import math
input = sys.stdin.readline
imp = 'IMPOSSIBLE'
t = int(input())
for test in range(t):
	(n, k) = list(map(int, input().split(' ')))
	if n - 1 >= (k - 1) * 2:
		res = []
		for i in range(n):
			if i % 2 == 0 and i / 2 < k:
				res.append(i * '.' + 'R' + (n - i - 1) * '.')
			else:
				res.append(n * '.')
	else:
		res = ['-1']
	for j in range(len(res)):
		print(res[j])


def solve(n, a):
	if a == 1 and n == 1:
		print('R')
		return 0
	if n % 2 == 1:
		if a > n // 2 + 1:
			print(-1)
			return 0
	elif a > n // 2:
		print(-1)
		return 0
	arr = [['.'] * n for i in range(n)]
	for i in range(a):
		arr[2 * i][2 * i] = 'R'
	for i in range(n):
		print(''.join(arr[i]))
	return 0
t = int(input())
for case in range(t):
	(n, a) = map(int, input().split())
	solve(n, a)


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	if k <= (n + 1) // 2:
		for i in range(n):
			if i & 1 or k == 0:
				print('.' * n)
			else:
				print('.' * i + 'R' + '.' * (n - i - 1))
				k = k - 1
	else:
		print(-1)


t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	if k > (n + 1) // 2:
		print(-1)
		continue
	result = [['.' for i in range(n)] for j in range(n)]
	r = 0
	c = 0
	for i in range(k):
		result[r][c] = 'R'
		r += 2
		c += 2
	for i in range(n):
		print(''.join(result[i]))


import sys
input = sys.stdin.readline
print = sys.stdout.write
t = int(input())
while t:
	(n, k) = map(int, input().split())
	if n < 2 * k - 1:
		print('{}\n'.format(-1))
	else:
		board = [['.' for i in range(n)] for j in range(n)]
		for (i, j) in zip(range(0, n, 2), range(0, n, 2)):
			if k > 0:
				board[i][j] = 'R'
				k -= 1
			else:
				break
		for row in board[:n]:
			print('{}\n'.format(''.join(row[:n])))
	t -= 1


for _ in range(int(input())):
	[n, k] = list(map(int, input().split()))
	if k <= (n + 1) // 2:
		chess = [['.' for _ in range(n)] for _ in range(n)]
		for i in range(k):
			chess[2 * i][2 * i] = 'R'
		print('\n'.join(list(map(lambda x: ''.join(x), chess))))
	else:
		print('-1')


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	t = '.' * n
	if n == k and n == 1:
		print('R')
	elif k > int((n + 1) / 2):
		print(-1)
	else:
		ls = []
		for i in range(n):
			ls.append(list('.' * n))
		for a in range(k):
			ls[2 * a][2 * a] = 'R'
		for b in range(n):
			print(''.join(ls[b]))


n = int(input())
for i in range(n):
	(size, num) = map(int, input().split())
	if num > (size + 1) / 2:
		print(-1)
		continue
	empty = '.' * size
	for j in range(num):
		if j > 0:
			print(empty)
		s = '.' * (2 * j)
		s += 'R'
		s += '.' * (size - 2 * j - 1)
		print(s)
	for j in range(size - 2 * num + 1):
		print(empty)


h = int(input())
for zz in range(h):
	(n, m) = map(int, input().split())
	if m > (n + 1) // 2 and (m > 1 or n > 1):
		print(-1)
	else:
		k = 1
		r = 0
		while k <= n:
			for i in range(n):
				print(2 * i * '.' + 'R' * (r < m) + (n - 2 * i - 1) * '.' + '.' * (r >= m))
				r += 1
				k += 1
				if k >= n:
					break
				print(n * '.')
				k += 1


for _ in range(int(input())):
	(n, k) = map(int, input().strip().split())
	if k > (n + 1) // 2:
		print(-1)
		continue
	for i in range(k):
		print('.' * 2 * i, 'R', '.' * (n - 2 * i - 1), sep='')
		if i == k - 1 and k > n // 2:
			break
		print('.' * n)
	for _ in range(n - 2 * k):
		print('.' * n)


for _ in range(int(input())):
	(n, r) = map(int, input().split())
	if r > (n + 1) // 2:
		print(-1)
	else:
		used = 0
		for i in range(n):
			if i % 2:
				print('.' * n)
			elif used >= r:
				print('.' * n)
			else:
				print('.' * i + 'R' + '.' * (n - i - 1))
				used += 1


t = int(input())
while t > 0:
	t -= 1
	n_k = [int(c) for c in input().split(' ')]
	(n, k) = (n_k[0], n_k[1])
	if 2 * k - 1 <= n:
		result = [['.'] * n for i in range(n)]
		(row, col) = (0, 0)
		for i in range(k):
			result[row][col] = 'R'
			row += 2
			col += 2
		for i in range(n):
			print(''.join(result[i]))
	else:
		print(-1)


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	if k == 1:
		if n == 1:
			print('R')
		else:
			print('R', end='')
			print('.' * (n - 1))
			for i in range(n - 1):
				print('.' * n)
	elif k > (n + 1) // 2:
		print(-1)
	else:
		for i in range(n):
			if i % 2 == 0 and k > 0:
				print('.' * i, end='')
				print('R', end='')
				print('.' * (n - i - 1))
				k = k - 1
			else:
				print('.' * n)


t = int(input())
for _ in range(t):
	(n, k) = list(map(int, input().split()))
	grid = [['.' for i in range(n)] for j in range(n)]
	g = 0
	while k > 0 and g < n:
		grid[g][g] = 'R'
		k -= 1
		g += 2
	if k == 0:
		for i in range(n):
			print(''.join(grid[i]))
	else:
		print(-1)


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	mat = [['.' for i in range(n)] for j in range(n)]
	k1 = k
	for i in range(0, n, 2):
		if k1 > 0:
			mat[i][i] = 'R'
			k1 -= 1
	if k > -(-n // 2):
		print(-1)
	else:
		for i in mat:
			print(''.join((j for j in i)))


import math

def ansprint(ans):
	if ans == -1:
		print(-1)
	else:
		n = len(ans)
		for i in range(n):
			print(''.join(ans[i]))

def solve(n, k):
	if k > math.ceil(n / 2):
		return -1
	ans = [['.' for j in range(n)] for i in range(n)]
	for i in range(k):
		ans[2 * i][2 * i] = 'R'
	return ans
t = int(input())
for _ in range(t):
	(n, k) = tuple(map(int, input().rstrip().split()))
	ans = solve(n, k)
	ansprint(ans)


T = int(input())
for tc in range(T):
	(n, k) = map(int, input().split())
	z = (n + 1) // 2
	if z < k:
		print(-1)
	else:
		L = [['.' for i in range(n)] for i in range(n)]
		for i in range(k):
			L[2 * i][2 * i] = 'R'
		for l in L:
			print(''.join(l))


n = int(input())
k = []
m = []
for i in range(n):
	(a, b) = map(int, input().split())
	k.append(a)
	m.append(b)
for i in range(n):
	if m[i] <= (k[i] + 1) // 2:
		cb = [['.' for j in range(k[i])] for j in range(k[i])]
		for q in range(m[i]):
			x = 2 * q
			cb[x][x] = 'R'
		for z in range(k[i]):
			print(''.join(cb[z]))
	else:
		print('-1')


m = int(input())
for i in range(m):
	(n, k) = [int(x) for x in input().split()]
	if int(n / 2 + 0.5) < k:
		print(-1)
	else:
		flag = 0
		for i in range(1, n + 1):
			if flag == 0:
				print('.' * (i - 1), end='')
				if k > 0:
					print('R', end='')
					k -= 1
				else:
					print('.', end='')
				print('.' * (n - i))
				flag = 1
			else:
				print('.' * n)
				flag = 0


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	if (n + 1) // 2 < k:
		print(-1)
	else:
		desk = [['.' for i in range(n)] for i in range(n)]
		for i in range(0, 2 * k, 2):
			desk[i][i] = 'R'
		for row in desk:
			print(''.join(row))


for _ in range(int(input())):
	(n, k) = list(map(int, input().split()))
	ans = [['.' for q in range(n)] for s in range(n)]
	i = 0
	while i < n:
		if k:
			ans[i][i] = 'R'
			k -= 1
			i += 2
		else:
			break
	if k > 0:
		print(-1)
	else:
		for a in ans:
			print(''.join(a))


import math
T = int(input())

def main(S, R) -> object:
	if R > math.ceil(S / 2):
		print(-1)
	else:
		for i in range(0, S, 2):
			if R > 0:
				print(i * '.' + 'R' + (S - i - 1) * '.')
				R -= 1
			else:
				print(S * '.')
			if i == S - 1:
				break
			print(S * '.')
x = []
for t in range(T):
	x.append(input())
for t in range(T):
	s = x[t]
	main(int(s.split()[0]), int(s.split()[1]))


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	if n < k * 2 - 1:
		print(-1)
		continue
	c = 1
	for i in range(1, n + 1):
		if i % 2 == 1 and c <= k:
			li = ['.' for i in range(n)]
			li[i - 1] = 'R'
			c += 1
			print(''.join(li))
		else:
			print('.' * n)


for i in range(int(input())):
	(n, k) = map(int, input().split())
	if k > n // 2 + n % 2:
		print(-1)
	else:
		matrix = [['.'] * n for i in range(n)]
		used = [0, 0]
		matrix[0][0] = 'R'
		(row, column) = (0, 0)
		for i in range(k - 1):
			row += 2
			column += 2
			matrix[row][column] = 'R'
		for i in matrix:
			print(''.join(i))


t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	if (n + 1) // 2 < k:
		print(-1)
	else:
		curr = 0
		tot = 0
		for i in range(0, 2 * n + 1, 2):
			if tot < k:
				print('.' * i + 'R' + '.' * (n - i - 1))
				tot += 1
			if tot + curr < n:
				print('.' * n)
				curr += 1


for t in range(int(input())):
	(n, k) = map(int, input().split())
	ans = ['.' * n for i in range(n)]
	(curr, count) = (0, 0)
	for i in range(0, n, 2):
		if count == k:
			break
		ans[i] = ans[i][:curr] + 'R' + ans[i][curr + 1:]
		curr += 2
		count += 1
	if ''.join(ans).count('R') == k:
		print(*ans, sep='\n')
	else:
		print(-1)


import math
t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	if math.ceil(n / 2) < k:
		print('-1')
		continue
	for i in range(n):
		if i % 2 == 0 and i < 2 * k - 1:
			print('.' * i + 'R' + '.' * (n - i - 1))
		else:
			print('.' * n)


def getStableArrangement(n, k):
	arrangement = []
	if n % 2 == 0:
		if k > n // 2:
			return arrangement
	elif k > n // 2 + 1:
		return arrangement
	placed = 0
	for line in range(n):
		newLine = ['.'] * n
		if placed < k:
			if line % 2 == 0:
				newLine[line] = 'R'
				placed += 1
		arrangement.append(newLine)
	if placed == k:
		return arrangement
	else:
		return []
t = int(input())
for count in range(t):
	(n, k) = map(int, input().split())
	arrangement = getStableArrangement(n, k)
	if len(arrangement) == 0:
		print(-1)
	else:
		for line in arrangement:
			print(''.join(line))


n = int(input())
for i in range(n):
	(n, k) = map(int, input().split())
	list1 = ['.' for i in range(n)]
	count = 0
	if n % 2 == 0:
		if k <= int(n / 2):
			for j in range(n):
				if (j + 1) % 2 != 0 and count < k:
					list1[j] = 'R'
					print(''.join(list1), end='\n')
					count += 1
					list1[j] = '.'
				else:
					print(''.join(list1), end='\n')
		else:
			print(-1)
	elif k <= int(n / 2) + 1:
		for j in range(n):
			if (j + 1) % 2 != 0 and count < k:
				list1[j] = 'R'
				print(''.join(list1), end='\n')
				count += 1
				list1[j] = '.'
			else:
				print(''.join(list1), end='\n')
	else:
		print(-1)


for _ in range(int(input())):
	nk = list(map(int, input().split()))
	n = nk[0]
	k = nk[1]
	if n == 1:
		print('R')
	elif n > 1:
		if int((n + 1) / 2) >= k:
			for i in range(1, n + 1):
				if i % 2 == 0 or k == 0:
					print('.' * n)
				elif k > 0:
					p = '.' * (i - 1)
					print(p, end='')
					print('R', end='')
					print('.' * (n - i))
					k -= 1
		else:
			print(-1)


n = int(input())
for i in range(n):
	(n, k) = map(int, input().rstrip().split())
	flag = True
	if n == 1:
		flag = False
		print('R')
	elif n % 2 == 0:
		m = n // 2
		if k > m:
			flag = False
			print(-1)
	elif n % 2 != 0:
		m = (n + 1) // 2
		if k > m:
			flag = False
			print(-1)
	if flag:
		rook = 0
		rooks = 1
		for i in range(n):
			arr = ['.' for i in range(n)]
			if (i + 1) % 2 != 0 and rooks <= k:
				arr[rook] = 'R'
				rooks += 1
			s = ''
			s = s.join(arr)
			print(s)
			rook += 1


count = int(input())
for _ in range(count):
	(a, b) = input().split()
	(a, b) = (int(a), int(b))
	c = 0
	d = 0
	e = True
	if b == 1:
		for i in range(a):
			if i == 0:
				print('R' + '.' * (a - 1))
			else:
				print(a * '.')
		e = False
	if a == b and e:
		print('-1')
		e = False
	if a % 2 == 1:
		c = a + 1
	if a % 2 == 0:
		c = a
	c = int(c / 2)
	if e:
		if c < b and e:
			print('-1')
		else:
			for i in range(a):
				j = a - i - 1
				if i % 2 == 0:
					if d < b:
						print(i * '.' + 'R' + j * '.')
						d += 1
					else:
						print(a * '.')
				else:
					print(a * '.')


t = int(input())
a = []
for i in range(t):
	a += [list(map(int, input().split()))]
for i in range(t):
	if a[i][0] < 2 * a[i][1] - 1:
		print('-1')
	else:
		for j in range(a[i][0]):
			k = a[i][1]
			if j % 2 == 1:
				print('.' * a[i][0])
			elif j % 2 == 0 and j <= 2 * (k - 1):
				print('.' * j + 'R' + '.' * (a[i][0] - j - 1))
			else:
				print('.' * a[i][0])


n = int(input())
for i in range(n):
	(a, b) = map(int, input().split())
	ans = []
	if a % 2 == 1 and b <= (a + 1) // 2:
		ctr = 0
		maxr = b
		for j in range(a):
			temp = '.' * a
			if j % 2 == 0 and maxr > 0:
				temp2 = list(temp)
				temp2[ctr] = 'R'
				temp = ''.join(temp2)
				maxr -= 1
				ctr += 2
			ans.append(temp)
		for j in ans:
			print(j)
	elif b <= a // 2:
		ctr = 0
		maxr = b
		for j in range(a):
			temp = '.' * a
			if j % 2 == 0 and maxr > 0:
				temp2 = list(temp)
				temp2[ctr] = 'R'
				temp = ''.join(temp2)
				maxr -= 1
				ctr += 2
			ans.append(temp)
		for j in ans:
			print(j)
	else:
		print('-1')


def ff(n, k):
	c = 0
	count = 0
	l = 0
	for i in range(n):
		if count == k:
			break
		if i % 2 == 0:
			print('.' * c + 'R' + '.' * (n - 1 - c))
			c += 2
			count += 1
		else:
			print('.' * n)
		l += 1
	if l < n:
		for i in range(n - l):
			print('.' * n)
	if count < k:
		print(-1)
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	if n % 2 == 0 and k > n // 2:
		print(-1)
	elif n % 2 == 1 and k > n // 2 + 1:
		print(-1)
	else:
		ff(n, k)


t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	if k > int((n + 1) / 2):
		print(-1)
	else:
		temp = k
		for i in range(n):
			s = '.' * n
			a = list(s)
			if i % 2 == 0 and temp > 0:
				a[i] = 'R'
				p = ''.join(a)
				print(p)
				temp -= 1
			else:
				print('.' * n)


from math import ceil
tt = int(input())
for x in range(tt):
	(n, k) = map(int, input().split())
	res = ceil(n / 2)
	if res >= k:
		l = [['.'] * n for _ in range(n)]
		for i in range(k):
			l[2 * i][2 * i] = 'R'
		print(*[''.join(k) for k in l], sep='\n')
	else:
		print(-1)


t = int(input())
while t != 0:
	(n, k) = map(int, input().split())
	if k > n // 2 + n % 2:
		print(-1)
	else:
		mat = ['.'] * n * n
		for i in range(0, n * n, n * 2 + 2):
			if k > 0:
				mat[i] = 'R'
				k -= 1
			else:
				break
		ans = []
		for i in range(0, n * n, n):
			ans.append(''.join(mat[i:i + n]))
		for i in ans:
			print(i)
	t -= 1


for t in range(int(input())):
	[n, h] = list(map(int, input().split()))
	cnt = 0
	cb = [['.' for i in range(n)] for i in range(n)]
	for i in range(n):
		if i % 2 == 0:
			cb[i][i] = 'R'
			cnt = cnt + 1
			if cnt == h:
				break
	if cnt == h:
		print('\n'.join(map(lambda t: ''.join(t), cb)))
	else:
		print(-1)


tests = int(input())
mylist = []
anotherlist = []
for i in range(tests):
	mylist.append(input().split(' '))
mystr = ''
for item in mylist:
	n = int(item[0])
	k = int(item[1])
	k2 = int(item[1])
	if n == 0:
		mystr += '-1\n'
	elif n % 2 == 0:
		if k > n / 2:
			mystr += '-1\n'
		else:
			for i2 in range(n):
				if (i2 + 1) % 2 == 0 or k2 <= 0:
					mystr += '.' * n + '\n'
				else:
					mystr += '.' * i2 + 'R' + '.' * (n - i2 - 1) + '\n'
					k2 -= 1
	elif k > (n + 1) / 2:
		mystr += '-1\n'
	else:
		for i2 in range(n):
			if (i2 + 1) % 2 == 0 or k2 <= 0:
				mystr += '.' * n + '\n'
			else:
				mystr += '.' * i2 + 'R' + '.' * (n - i2 - 1) + '\n'
				k2 -= 1
print(mystr)


t = int(input())
for i in range(t):
	r = list(map(int, input().split()))
	n = r[0]
	k = r[1]
	if n % 2 == 0:
		if n / 2 >= k:
			count = 0
			for j in range(n):
				print('.' * j, end='')
				if not j % 2:
					if count < k:
						print('R', end='')
						count += 1
					else:
						print('.', end='')
				else:
					print('.', end='')
				print('.' * (n - j - 1))
		else:
			print(-1)
	elif (n + 1) / 2 >= k:
		count = 0
		for j in range(n):
			print('.' * j, end='')
			if not j % 2:
				if count < k:
					print('R', end='')
					count += 1
				else:
					print('.', end='')
			else:
				print('.', end='')
			print('.' * (n - j - 1))
	else:
		print(-1)


T = int(input())
while T:
	s = input()
	s = s.split()
	n = int(s[0])
	k = int(s[1])
	if n // 2 + n % 2 < k:
		print(-1)
	else:
		for i in range(n):
			if i % 2 == 0 and k != 0:
				print(i * '.' + 'R' + (n - i - 1) * '.')
				k = k - 1
			else:
				print(n * '.')
	T = T - 1


from math import *
t = int(input())
for q in range(t):
	(n, r) = map(int, input().split())
	ce = ceil(n / 2)
	if r > ce:
		print(-1)
	elif r <= ce:
		matrix = [['.'] * n for _ in range(n)]
		i = 0
		while i < r:
			matrix[2 * i][2 * i] = 'R'
			i += 1
		print(*[''.join(r) for r in matrix], sep='\n')


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	obj = 0
	if 2 * k - 1 <= n:
		for u in range(n):
			l = ['.' for j in range(n)]
			if u % 2 != 0:
				print(''.join(l))
			else:
				if obj < k:
					l[u] = 'R'
					print(''.join(l))
				else:
					print(''.join(l))
				obj += 1
	else:
		print(-1)


import math
x = int(input())
l = []
for i in range(x):
	y = list(map(int, input().split()))
	l.append(y)

def function(l):
	x = l[0]
	y = l[1]
	li = []
	if x == 1 and y == 1:
		li.append('R')
		return li
	if y > math.ceil(x / 2):
		li.append(-1)
		return li
	if y <= math.ceil(x / 2):
		li = []
		j = 0
		st = ''
		z = 0
		for i in range(x):
			if i % 2 == 0:
				st = st + '.' * (x - 1)
				if z < y:
					st = list(st)
					st.insert(j, 'R')
					st = ''.join(st)
					j = j + 2
					li.append(st)
					st = ''
					z = z + 1
					continue
				if z >= y:
					st = ''
					st = st + '.' * x
				li.append(st)
				st = ''
			if i % 2 == 1:
				li.append('.' * x)
		return li
for i in range(len(l)):
	x = function(l[i])
	for j in x:
		print(j)


def rooks(n, k):
	if n % 2 == 1:
		max_k = (n + 1) // 2
	else:
		max_k = n // 2
	if k > max_k:
		return -1
	else:
		board = [['.'] * n for _ in range(n)]
		for i in range(0, min(2 * k, 2 * max_k), 2):
			board[i][i] = 'R'
		resp = ''
		for i in range(0, n):
			if i < n - 1:
				resp += ''.join(board[i]) + '\n'
			else:
				resp += ''.join(board[i])
		return resp
t = int(input())
for _ in range(0, t):
	arr = list(map(int, input().rstrip().split()))
	n = arr[0]
	k = arr[1]
	response = rooks(n, k)
	print(f'{response}')


num_test = int(input(''))
for ddd in range(num_test):
	(size_bor, nums_rooks) = input('').split(' ')
	(size_bor, nums_rooks) = (int(size_bor), int(nums_rooks))
	if size_bor < nums_rooks or (size_bor + 1) / 2 < nums_rooks:
		print('-1')
	elif size_bor == 1 and nums_rooks == 1:
		print('R')
	else:
		for c in range(1, size_bor + 1):
			if not c % 2:
				d = ['.'] * size_bor
				print(''.join(d))
			else:
				d = ['.'] * size_bor
				if nums_rooks:
					d[c - 1] = 'R'
					nums_rooks -= 1
				print(''.join(d))


def fn(n, k):
	r = 1
	s = ''
	while k > 0:
		if r % 2 != 0:
			if r != n:
				s = s + '.' * (r - 1) + 'R' + '.' * (n - r) + '\n'
			else:
				s = s + '.' * (n - 1) + 'R'
			k = k - 1
		else:
			s = s + '.' * n + '\n'
		r = r + 1
	if r < n:
		s = s + ('.' * n + '\n') * (n - r)
		s = s + '.' * n
		return s
	elif r == n:
		s = s + '.' * n
		return s
	else:
		return s
cost = []
T = int(input())
for i in range(T):
	(n, k) = input().split()
	(n, k) = [int(n), int(k)]
	if k <= (n + 1) / 2:
		cost = cost + [fn(n, k)]
	else:
		cost = cost + ['-1']
for i in range(T):
	print(cost[i])


t = int(input())
for i in range(t):
	nk = input().split()
	n = int(nk[0])
	k = int(nk[1])
	if 2 * k - 1 > n:
		print(-1)
	else:
		b = ''
		for i in range(1, n):
			b += '.'
		for i in range(n):
			c = b
			if i % 2 == 0 and k > 0:
				c = c[:i] + 'R' + c[i:]
				k -= 1
			else:
				c += '.'
			print(c)


for _ in range(int(input())):
	ans = []
	(n, k) = map(int, input().split())
	p = 0
	ok = True
	while k > 0:
		s = ['.'] * n
		if p % 2 == 1:
			ans.append(''.join(s))
			p += 1
			continue
		if p < n:
			s[p] = 'R'
		else:
			ok = False
			print(-1)
			break
		p += 1
		k -= 1
		ans.append(''.join(s))
	if ok:
		for i in ans:
			print(i)
		if len(ans) != n:
			for _ in range(n - len(ans)):
				print('.' * n)


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	if k << 1 > n + 1:
		print(-1)
		continue
	grid = [['.'] * n for __ in range(n)]
	for i in range(0, k << 1, 2):
		grid[i][i] = 'R'
	print('\n'.join((''.join(row) for row in grid)))


import math
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	a = math.ceil(n / 2)
	if a < k:
		print(-1)
	else:
		x = ['.'] * n
		for i in range(0, n, 2):
			if k > 0:
				x[i] = 'R'
			print(''.join(x))
			if i < n - 1:
				print('.' * n)
			x[i] = '.'
			k -= 1


def solve() -> str:
	(n, k) = map(int, input().split())
	if k > n // 2 + n % 2:
		print(-1)
	else:
		for i in range(n):
			if i % 2 == 1 or not k:
				print('.' * n)
			else:
				print('.' * i + 'R' + '.' * (n - i - 1))
				k -= 1

def main() -> None:
	t = int(input())
	for _ in range(t):
		solve()
main()


for i in range(int(input())):
	(n, k) = list(map(int, input().split()))
	r = 0
	if n % 2 == 0:
		if k > int(n / 2):
			print(-1)
		else:
			for i in range(1, n + 1):
				if i % 2 != 0:
					if r == k:
						print('.' * n)
						continue
					print('.' * (i - 1) + 'R' + '.' * (n - i))
					r += 1
				else:
					print('.' * n)
	elif k > int(n / 2) + 1:
		print(-1)
	else:
		for j in range(1, n + 1):
			if j % 2 != 0:
				if r == k:
					print('.' * n)
					continue
				print('.' * (j - 1) + 'R' + '.' * (n - j))
				r += 1
			else:
				print('.' * n)


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	if n % 2 != 0 and k > n // 2 + 1 or (n % 2 == 0 and k > n // 2):
		print(-1)
	else:
		cc = 0
		cline = 0
		while k > 0:
			zz = ['.'] * n
			if cline % 2 == 0:
				zz[cc] = 'R'
				k -= 1
				cc += 2
			print(''.join(zz))
			cline += 1
		if cline < n:
			for i in range(abs(cline - n)):
				print('.' * n)


t = int(input())
for j in range(0, t):
	(n, k) = map(int, input().split())
	if n % 2 != 0:
		if k > n // 2 + 1:
			print(-1)
		else:
			p = []
			for i in range(0, n):
				p.append('.')
			for i in range(0, n):
				if i % 2 == 0 and k > 0:
					p[i] = 'R'
					print(''.join(p))
					p[i] = '.'
					k -= 1
				else:
					print(''.join(p))
	elif k > n // 2:
		print(-1)
	else:
		p = []
		for i in range(0, n):
			p.append('.')
		for i in range(0, n):
			if i % 2 == 0 and k > 0:
				p[i] = 'R'
				print(''.join(p))
				p[i] = '.'
				k -= 1
			else:
				print(''.join(p))


t = int(input())
for i in range(t):
	(n, k) = list(map(int, input().split()))
	if n % 2 == 0:
		if n // 2 >= k:
			for i in range(0, n):
				if i // 2 + 1 <= k:
					if i % 2 == 0:
						print('.' * i + 'R' + '.' * (n - i - 1))
					else:
						print('.' * n)
				else:
					print('.' * n)
		else:
			print(-1)
	elif n // 2 + 1 >= k:
		for i in range(0, n):
			if i // 2 + 1 <= k:
				if i % 2 == 0:
					print('.' * i + 'R' + '.' * (n - i - 1))
				else:
					print('.' * n)
			else:
				print('.' * n)
	else:
		print(-1)


for i in range(int(input())):
	(n, k) = map(int, input().split())
	if (n - 1) // 2 + 1 >= k:
		for j in range(n):
			if j % 2 == 0 and k:
				print('.' * j + 'R' + '.' * (n - j - 1))
				k -= 1
			else:
				print('.' * n)
	else:
		print(-1)


import sys
input = sys.stdin.readline
t = int(input())
while t > 0:
	(n, k) = map(int, input().split())
	if k > (n + 1) // 2:
		print(-1)
	else:
		for i in range(n):
			if i % 2 == 0 and k != 0:
				print('.' * i + 'R' + '.' * (n - i - 1))
				k -= 1
			else:
				print('.' * n)
	t -= 1


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	if n % 2 == 0:
		if k > n // 2:
			print(-1)
			continue
	elif k > (n + 1) // 2:
		print(-1)
		continue
	cnt = 0
	for i in range(n):
		if i % 2 == 0 and cnt < k:
			pos = 2 * cnt + 1
			print('.' * (pos - 1) + 'R' + '.' * (n - pos))
			cnt += 1
			pass
		else:
			print('.' * n)


import sys

def get_ints():
	return map(int, sys.stdin.readline().strip().split())

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

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

def get_string():
	return sys.stdin.readline().strip()

def get_int():
	return int(sys.stdin.readline().strip())

def get_print_int(x):
	sys.stdout.write(str(x) + '\n')

def get_print(x):
	sys.stdout.write(x + '\n')

def get_print_int_same(x):
	sys.stdout.write(str(x) + ' ')

def get_print_same(x):
	sys.stdout.write(x + ' ')
from sys import maxsize
from math import ceil

def solve():
	for _ in range(get_int()):
		(n, k) = get_ints()
		if k <= ceil(n / 2):
			prev = 0
			while k > 0:
				get_print('.' * prev + 'R' + '.' * (n - prev - 1))
				k -= 1
				if k > 0:
					get_print('.' * n)
				else:
					break
				prev += 2
			while prev + 1 < n:
				get_print('.' * n)
				prev += 1
		else:
			get_print_int(-1)
solve()


from sys import stdin
from math import ceil

def solve():
	for _ in range(int(stdin.readline().strip())):
		(n, k) = map(int, stdin.readline().rstrip().split())
		if k > ceil(n / 2):
			print(-1)
			continue
		cnt = 0
		for i in range(n):
			if i % 2 or cnt == k:
				print('.' * n)
				continue
			print('.' * i + 'R' + '.' * (n - i - 1))
			cnt += 1
solve()


from math import *
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	if k > (n + 1) // 2:
		print(-1)
		continue
	s = [['.'] * n for _ in range(n)]
	for i in range(k):
		s[2 * i][2 * i] = 'R'
	for j in s:
		print(''.join(j))


t = int(input())
for i in range(t):
	(n, k) = input().split()
	(n, k) = (int(n), int(k))
	if n % 2 != 0:
		p = n // 2 + 1
	elif n % 2 == 0:
		p = n // 2
	if k <= p:
		i = 0
		while i < n:
			if i % 2 == 0 and i <= 2 * k - 1:
				print('.' * i + 'R' + '.' * (n - i - 1))
				i += 1
			else:
				print('.' * n)
				i += 1
	else:
		print(-1)


t = int(input())
for i in range(t):
	(n, rooks) = list(map(int, input().split()))
	if rooks > (n + 1) // 2:
		print(-1)
		continue
	r = 0
	for i in range(n):
		if r == rooks:
			print(n * '.')
		elif i % 2 == 0:
			s = '.' * i + 'R' + (n - 1 - i) * '.'
			r = r + 1
			print(s)
		else:
			print(n * '.')


for i in range(int(input())):
	(n, k) = map(int, input().split())
	r = 0
	arr = list()
	for i in range(n):
		string = ['.'] * n
		if i % 2 == 0 and r < k:
			string[i] = 'R'
			r = r + 1
		arr.append(''.join(string))
	if r != k:
		print(-1)
	else:
		print('\n'.join(arr))


from math import ceil
t = int(input())
while t != 0:
	(n, k) = map(int, input().split())
	if ceil(n / 2) < k:
		print(-1)
	else:
		for i in range(n):
			if i % 2 == 0 and k != 0:
				s = '.' * i + 'R' + '.' * (n - i - 1)
				print(s)
				k = k - 1
			else:
				s = '.' * n
				print(s)
	t = t - 1


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	n = (a + 1) // 2
	if b <= n:
		i = 0
		for j in range(a):
			if i < b and j % 2 == 0:
				print('.' * j + 'R' + '.' * (a - j - 1))
				i += 1
			else:
				print('.' * a)
	else:
		print(-1)


import sys
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	if n < 2 * k - 1:
		sys.stdout.write('-1\n')
	else:
		x = 1
		k -= 1
		for row in range(n):
			line = ['.'] * n
			if row % 2 == 0 and x:
				line[x - 1] = 'R'
				if k > 0:
					k -= 1
					x += 2
				else:
					x = None
			sys.stdout.write(f"{''.join(line)}\n")