적녹 색맹이라 green과 blue를 구별하지 못한다.
입력으로 주어진 두 문자열이 적녹 색맹 입장에서 봤을 때 같은 문자열인지 판단하는 문제이다.
따라서 두 문자열 중 blue를 green으로 다 바꿔준다.(반대로 해도 된다.)
그리고 비교해 같은지 판단한다.
t = int(input())
for _ in range(t):
n = int(input())
up_row = list(map(lambda x: 'G' if x == 'B' else x, input()))
down_row = list(map(lambda x: 'G' if x == 'B' else x, input()))
if up_row == down_row:
print('YES')
else:
print('NO')