Let $n$ be a positive integer. Let $a, b, c$ be nonnegative integers such that $a + b + c = n$.

Alice and Bob are gonna play rock-paper-scissors $n$ times. Alice knows the sequences of hands that Bob will play. However, Alice has to play rock $a$ times, paper $b$ times, and scissors $c$ times.

Alice wins if she beats Bob in at least $\lceil \frac{n}{2} \rceil$ ($\frac{n}{2}$ rounded up to the nearest integer) hands, otherwise Alice loses.

Note that in rock-paper-scissors:

  rock beats scissors;  paper beats rock;  scissors beat paper. 

The task is, given the sequence of hands that Bob will play, and the numbers $a, b, c$, determine whether or not Alice can win. And if so, find any possible sequence of hands that Alice can use to win.

If there are multiple answers, print any of them.


-----Input-----

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

Then, $t$ testcases follow, each consisting of three lines:   The first line contains a single integer $n$ ($1 \le n \le 100$).  The second line contains three integers, $a, b, c$ ($0 \le a, b, c \le n$). It is guaranteed that $a + b + c = n$.  The third line contains a string $s$ of length $n$. $s$ is made up of only 'R', 'P', and 'S'. The $i$-th character is 'R' if for his $i$-th Bob plays rock, 'P' if paper, and 'S' if scissors. 


-----Output-----

For each testcase:   If Alice cannot win, print "NO" (without the quotes).  Otherwise, print "YES" (without the quotes). Also, print a string $t$ of length $n$ made up of only 'R', 'P', and 'S' — a sequence of hands that Alice can use to win. $t$ must contain exactly $a$ 'R's, $b$ 'P's, and $c$ 'S's.  If there are multiple answers, print any of them. 

The "YES" / "NO" part of the output is case-insensitive (i.e. "yEs", "no" or "YEs" are all valid answers). Note that 'R', 'P' and 'S' are case-sensitive.


-----Example-----
Input
2
3
1 1 1
RPS
3
3 0 0
RPS

Output
YES
PSR
NO



-----Note-----

In the first testcase, in the first hand, Alice plays paper and Bob plays rock, so Alice beats Bob. In the second hand, Alice plays scissors and Bob plays paper, so Alice beats Bob. In the third hand, Alice plays rock and Bob plays scissors, so Alice beats Bob. Alice beat Bob 3 times, and $3 \ge \lceil \frac{3}{2} \rceil = 2$, so Alice wins.

In the second testcase, the only sequence of hands that Alice can play is "RRR". Alice beats Bob only in the last hand, so Alice can't win. $1 < \lceil \frac{3}{2} \rceil = 2$.

Difficulty: interview

Starter code:

Solutions:
t = int(input())

for _ in range(t):
	n = int(input())
	a, b, c = map(int, input().split())
	s = input()

	t = ["X"] * n
	wins = 0
	for i, en in enumerate(s):
		if en=="R" and b:
			b-=1
			t[i] = "P"
			wins += 1
		elif en=="P" and c:
			c-=1
			t[i] = "S"
			wins += 1
		elif en=="S" and a:
			a-=1
			t[i] = "R"
			wins += 1

	if wins < n/2:
		print("NO")
	else:
		print("YES")
		for i, my in enumerate(t):
			if my=="X":
				if a:a-=1;t[i]="R"
				elif b:b-=1;t[i]="P"
				elif c:c-=1;t[i]="S"
		print("".join(t))

t = int(input())

for _ in range(t):
    n = int(input())
    a,b,c = list(map(int,input().split()))
    ss = input()
    r,p,s = ss.count('R'),ss.count('P'),ss.count('S')
    win = min(a, s) + min(b, r) + min(c, p)
    if win < (n + 1) // 2:
        print('NO')
        continue
    print('YES')
    res = ['' for i in range(n)]
    for i in range(n):
        if ss[i] == 'R' and b > 0:
            res[i] = 'P'
            b -= 1
        if ss[i] == 'P' and c > 0:
            res[i] = 'S'
            c -= 1
        if ss[i] == 'S' and a > 0:
            res[i] = 'R'
            a -= 1
    for i in range(n):
        if res[i] == '':
            if a:
                res[i] = 'R'
                a -= 1
            elif b:
                res[i] = 'P'
                b -= 1
            elif c:
                res[i] = 'S'
                c -= 1
    print(''.join(res))


from math import gcd

t = int(input())
for q in range(t):
    nn = int(input())
    k, b, n = list(map(int, input().split()))
    s = input()
    w = 0
    aaa = [0] * nn
    for i in range(nn):
        if s[i] == 'R' and b:
            w += 1
            b -= 1
            aaa[i] = 'P'
        elif s[i] == 'P' and n:
            w += 1
            n -= 1
            aaa[i] = 'S'
        elif s[i] == 'S' and k:
            w += 1
            k -= 1
            aaa[i] = 'R'
    for i in range(nn):
        if type(aaa[i]) == int:
            if k:
                k -= 1
                aaa[i] = 'R'
            elif b:
                b -= 1
                aaa[i] = 'P'
            else:
                n -= 1
                aaa[i] = 'S'
    if nn // 2 + nn % 2 <= w:
        print('YES')
        print(''.join(aaa))
    else:
        print('NO')


from math import *
from collections import *
t = int(input())
for y in range(t):
    n = int(input())
    a,b,c = map(int,input().split())
    s = input()
    ct = 0
    l = ['0' for i in range(n)]
    for i in range(n):
        if(s[i] == 'R' and b != 0):
            ct += 1
            l[i] = 'P'
            b -= 1
        elif(s[i] == 'P' and c != 0):
            ct += 1
            l[i] = 'S'
            c -= 1
        elif(s[i] == 'S' and a != 0):
            ct += 1
            l[i] = 'R'
            a -= 1
    for i in range(n):
        if(l[i] == '0' and a != 0):
            l[i] = 'R'
            a -= 1
        elif(l[i] == '0' and b != 0):
            l[i] = 'P'
            b -= 1
        elif(l[i] == '0'):
            l[i] = 'S'
            c -= 1
    if(ct >= n/2):
        print("YES")
        print("".join(l))
    else:
        print("NO")

f = lambda i: (i + 1) % 3
for TT in range(1, int(input()) + 1):
    n = int(input())
    l = [*map(int, input().split())]
    s = ['RPS'.index(e) for e in input()]
    valid = True
    res = [-1] * n

    cnt = 0
    # first distribute optimally
    for i, e in enumerate(s):
        j = f(e)
        if l[j] > 0:
            l[j] -= 1
            res[i] = j
            cnt += 1
    
    # now assign the leftovers randomly
    j = 0
    for i in range(n):
        if res[i] != -1: continue
        while j < 3 and l[j] == 0: j += 1
        res[i] = j
        l[j] -= 1


    valid &= cnt >= ((n + 1) // 2)
    if valid:
        print('YES')
        print(''.join('RPS'[e] for e in res))
    else:
        print('NO')

for i in range(int(input())):
    n = int(input())
    a, b, c = list(map(int, input().split()))
    s = input()
    res = ['']*n
    w=0
    for j in range(n):
        if s[j]=='R' and b:
            b-=1
            res[j]='P'
            w+=1
        elif s[j]=='P' and c:
            c-=1
            res[j]='S'
            w+=1
        elif s[j]=='S' and a:
            a-=1
            res[j]='R'
            w+=1
    for j in range(n):
        if res[j]=='':
            if a:
                res[j]='R'
                a-=1
            elif b:
                res[j]='P'
                b-=1
            elif c:
                res[j]='S'
                c-=1
    if w>=(n+1)//2:
        print("YES")
        print(''.join(res))
    else:
        print("NO")


from math import*
q=int(input())
for t in range(q):
    n=int(input())
    a,b,c=map(int,input().split())
    s=input()
    ans=['0']*n
    an=0
    for i in range(len(s)):
        if s[i]=='R' and b>0:
            ans[i]='P'
            b-=1
            an+=1
        if s[i]=='P' and c>0:
            ans[i]='S'
            c-=1
            an+=1
        if s[i]=='S' and a>0:
            ans[i]='R'
            a-=1
            an+=1
    if an>=((n+1)//2):
        print("YES")
        for i in range(len(ans)):
            if ans[i]=='0':
                if a>0:
                    ans[i]='R'
                    a-=1
                elif b>0:
                    ans[i]='P'
                    b-=1
                else:
                    ans[i]='S'
                    c-=1
        for i in range(len(ans)):
            print(ans[i],end='')
        print()
    else:
        print("NO")

from sys import stdin
from math import ceil
t=int(stdin.readline().strip())
for caso in range(t):
    n=int(stdin.readline().strip())
    s=list(map(int,stdin.readline().strip().split()))
    s1=stdin.readline().strip()
    ans=["" for i in range(n)]
    r=0
    for i in range(n):
        if s1[i]=="R" and s[1]>0:
            ans[i]="P"
            s[1]-=1
            r+=1
        elif s1[i]=="P" and s[2]>0:
            ans[i]="S"
            r+=1
            s[2]-=1
        elif s1[i]=="S" and s[0]>0:
            ans[i]="R"
            r+=1
            s[0]-=1
    for i in range(n):
        if ans[i]=="":
            if s[0]>0:
                ans[i]="R"
                s[0]-=1
            elif s[1]>0:
                ans[i]="P"
                s[1]-=1
            else:
                ans[i]="S"
                s[2]-=1
    if r>=ceil(n/2):
        print("YES")
        res=""
        for i in range(n):
            res+=ans[i]
        print(res)
    else:
        print("NO")
    


3

import array
from fractions import Fraction
import functools
import itertools
import math
import os
import sys


def main():
    T = read_int()
    for _ in range(T):
        N = read_int()
        A, B, C = read_ints()
        S = inp()
        ans = solve(N, A, B, C, S)
        if not ans:
            print('NO')
        else:
            print('YES')
            print(ans)


def solve(N, A, B, C, S):
    sol = [None] * N
    wins = 0
    for i in range(N):
        if S[i] == 'S' and A > 0:
            sol[i] = 'R'
            A -= 1
            wins += 1
        if S[i] == 'R' and B > 0:
            sol[i] = 'P'
            B -= 1
            wins += 1
        if S[i] == 'P' and C > 0:
            sol[i] = 'S'
            C -= 1
            wins += 1

    if wins < (N + 1) // 2:
        return None

    for i in range(N):
        if sol[i] is None:
            if A > 0:
                sol[i] = 'R'
                A -= 1
            elif B > 0:
                sol[i] = 'P'
                B -= 1
            else:
                sol[i] = 'S'
                C -= 1

    return ''.join(sol)


###############################################################################
# AUXILIARY FUNCTIONS

DEBUG = 'DEBUG' in os.environ


def inp():
    return sys.stdin.readline().rstrip()


def read_int():
    return int(inp())


def read_ints():
    return [int(e) for e in inp().split()]


def dprint(*value, sep=' ', end='\n'):
    if DEBUG:
        print(*value, sep=sep, end=end)


def __starting_point():
    main()

__starting_point()

# import sys
# input = sys.stdin.readline

t = int(input())
for i in range(t):
    n = int(input())
    r,p,s = list(map(int,input().split()))
    st = input()

    rr = st.count("R")
    pp = st.count("P")
    ss = st.count("S")

    w = -((-n)//2)
    # print(min(r,ss),min(s,pp),min(p,rr),w)
    if min(r,ss)+min(s,pp)+min(p,rr) >= w:
        print("YES")
        ANS = ["n"] * n
        for j in range(n):
            if r > 0 and st[j] == "S":
                ANS[j] = "R"
                r-=1
            elif p > 0 and st[j] == "R":
                ANS[j] = "P"
                p-=1
            elif s > 0 and st[j] == "P":
                ANS[j] = "S"
                s-=1
        for j in range(n):
            if ANS[j] == "n":
                if r > 0:
                    ANS[j] = "R"
                    r-=1
                elif p > 0:
                    ANS[j] = "P"
                    p-=1
                elif s > 0:
                    ANS[j] = "S"
                    s-=1
        print("".join(ANS))
    else:
        print("NO")


t = int(input())

for _ in range(t):
    n = int(input())
    r, p, s = map(int, input().split())
    S = input()
    ans = [None]*n
    win = 0
    for i, c in enumerate(S):
        if c == 'R' and p > 0:
            ans[i] = 'P'
            p -= 1
            win += 1
        elif c == 'P' and s > 0:
            ans[i] = 'S'
            s -= 1
            win += 1
        elif c == 'S' and r > 0:
            ans[i] = 'R'
            r -= 1
            win += 1
    for i in range(n):
        if ans[i] is None:
            if r > 0:
                ans[i] = 'R'
                r -= 1
            elif p > 0:
                ans[i] = 'P'
                p -= 1
            else:
                ans[i] = 'S'
                s -= 1

    if win >= (n+1)//2:
        print('YES')
        print(*ans, sep='')
    else:
        print('NO')


from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,copy,time
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())

t = inp()

for _ in range(t):
    n = inp()
    aa = inpl() # RPS
    bb = input()
    ans = []
    for b in bb:
        if b == 'R':
            if aa[1] > 0:
                ans.append("P")
                aa[1] -= 1
            else:
                ans.append(-1)
        elif b == 'P':
            if aa[2] > 0:
                aa[2] -= 1
                ans.append("S")
            else:
                ans.append(-1)
        elif b == 'S':
            if aa[0] > 0:
                aa[0] -= 1
                ans.append("R")
            else:
                ans.append(-1)
    if n-sum(aa) < (n+1)//2:
        print("NO")
    else:
        print("YES")
        for i in range(n):
            if ans[i] == -1:
                if aa[0] > 0:
                    ans[i] = "R"
                    aa[0] -= 1
                elif aa[1] > 0:
                    ans[i] = "P"
                    aa[1] -= 1
                elif aa[2] > 0:
                    ans[i] = "S"
                    aa[2] -= 1
        print("".join(ans))


q=int(input())
for queries in range(q):
    n=int(input())
    a,b,c=list(map(int, input().split()))
    s=input()
    req = (n+1) // 2
    s2=[]
    for i in s:
        if i=="R":
            if b > 0:
                s2+=["P"]
                req-=1
                b-=1
            else:
                s2 += ["2"]
        if i=="P":
            if c > 0:
                s2+=["S"]
                req-=1
                c-=1
            else:
                s2 += ["3"]
        if i=="S":
            if a > 0:
                s2+=["R"]
                req-=1
                a-=1
            else:
                s2 += ["1"]
    if req > 0:
        print("NO")
    else:
        print("YES")
        for i in range(n):
            if s2[i]=="1":
                if b > 0:
                    b-=1
                    s2[i] = "P"
                elif c > 0:
                    c-=1
                    s2[i] = "S"
            if s2[i]=="2":
                if a > 0:
                    a-=1
                    s2[i] = "R"
                elif c > 0:
                    c-=1
                    s2[i] = "S"
            if s2[i]=="3":
                if b > 0:
                    b-=1
                    s2[i] = "P"
                elif a > 0:
                    a-=1
                    s2[i] = "R"
        print("".join(s2))




'''
Created on 2019. 9. 21.

@author: kkhh88
'''
#q = int(input())
#x, y = map(int,input().split(' '))

import math
q = int(input())
for _ in range(q):
    n = int(input())
    a, b, c = map(int,input().split(' '))

    bob = input()
    alice = ['X'] * n
    
    cnt = 0
    for i in range(n):
        s = bob[i]
        if s == 'R' and b > 0:
            b = b - 1
            cnt = cnt + 1
            alice[i] = 'P'
        elif s == 'P' and c > 0:
            c = c - 1
            cnt = cnt + 1
            alice[i] = 'S'
        elif s == 'S' and a > 0:
            a = a - 1
            cnt = cnt + 1
            alice[i] = 'R'
                
    if (n + 1) // 2 <= cnt:
        win = ''
        for i in range(n):
            if alice[i] == 'X':
                if a > 0:
                    a = a - 1
                    win = win + 'R' 
                elif b > 0:
                    b = b - 1
                    win = win + 'P'
                elif c > 0:
                    c = c - 1
                    win = win + 'S'
            else:
                win = win + alice[i]
        print ("YES")
        print (win)
    else:
        print ("NO")

import sys
input = sys.stdin.readline

t=int(input())

for testcases in range(t):
    n=int(input())
    a,b,c=list(map(int,input().split()))
    B=input().strip()

    R=B.count("R")
    P=B.count("P")
    S=B.count("S")

    if min(b,R)+min(c,P)+min(a,S)>=n/2:
        print("YES")
    else:
        print("NO")
        continue

    ANS=[0]*n

    R0=min(a,S)
    P0=min(b,R)
    S0=min(c,P)

    R1=a-R0
    P1=b-P0
    S1=c-S0

    for i in range(n):
        if B[i]=="S" and R0>0:
            ANS[i]="R"
            R0-=1
        elif B[i]=="R" and P0>0:
            ANS[i]="P"
            P0-=1
        elif B[i]=="P" and S0>0:
            ANS[i]="S"
            S0-=1

    for i in range(n):
        if ANS[i]==0:
            if R1>0:
                R1-=1
                ANS[i]="R"

            elif P1>0:
                P1-=1
                ANS[i]="P"

            else:
                S1-=1
                ANS[i]="S"

    print("".join(ANS))



q = int(input())
for re in range(q):
	n = int(input())
	a, b, c = list(map(int,input().split()))
	st = input()
	odp = [0] * n
	wyn = 0
	for i in range(n):
		if st[i] == 'R' and b > 0:
			wyn += 1
			b -= 1
			odp[i] = 'P'
		if st[i] == 'P' and c > 0:
			wyn += 1
			c -= 1
			odp[i] = 'S'
		if st[i] == 'S' and a > 0:
			wyn += 1
			a -= 1
			odp[i] = 'R'
	for i in range(n):
		if odp[i] == 0:
			if a > 0:
				a -= 1
				odp[i] = 'R'
			elif b > 0:
				b -= 1
				odp[i] = 'P'
			else:
				c -= 1
				odp[i] = 'S'
	if wyn >= (n + 1)//2:
		print("YES")
		for i in range(n):
			if i < n - 1:
				print(odp[i], end = "")
			else:
				print(odp[i])
	else:
		print("NO")

t = int(input())
for i in range(t):
    n = int(input())
    a, b, c = map(int, input().split())
    s = input()
    count = 0
    ans = ["" for i in range(n)]
    for i in range(n):
        if s[i] == "P" and c != 0:
            ans[i] = "S"
            c -= 1
            count += 1
        if s[i] == "S" and a != 0:
            a -= 1
            ans[i] = "R"
            count += 1
        if s[i] == "R" and b != 0:
            b -= 1
            count += 1
            ans[i] = "P"
    for i in range(n):
        if ans[i] == "" and a != 0:
            ans[i] = "R"
            a -= 1
        elif ans[i] == "" and b != 0:
            ans[i] = "P"
            b -= 1
        elif ans[i] == "" and c != 0:
            ans[i] = "S"
            c -= 1
    if count >= (n + 1) // 2:
        print("YES")
        print(*ans, sep="")
    else:
        print("NO")

for testcase in range(int(input())):
    n = int(input())
    ra, pa, sa = list(map(int, input().split()))
    beat = {'R': 'P', 'P': 'S', 'S': 'R'}
    a_beat = {'R': pa, 'P': sa, 'S': ra}
    a_sec = []
    win_time = 0
    for i in input().strip():
        if a_beat[i] > 0:
            win_time += 1
            a_beat[i] -= 1
            a_sec.append(beat[i])
        else:
            a_sec.append('.')
    for i in range(n):
        if a_sec[i] != '.':
            continue
        for key in 'RPS':
            if a_beat[key] == 0:
                continue
            a_sec[i] = beat[key]
            a_beat[key] -= 1
            break
    print('YES\n' + ''.join(a_sec)  if win_time >= (n + 1) // 2 else 'NO')




t = int(input())
for i in range(t):
    n = int(input())
    a, b, c = list(map(int, input().split()))
    d = list(input())
    ans = 0
    ansarr = ['0' for x in range(n)]
    ansstr = ''
    for j in range(n):
        if d[j] == 'R' and b > 0:
            b -= 1
            ans += 1
            ansarr[j] = 'P'
        elif d[j] == 'P' and c > 0:
            c -= 1
            ans += 1
            ansarr[j] = 'S'
        elif d[j] == 'S' and a > 0:
            a -= 1
            ans += 1
            ansarr[j] = 'R'
    for j in range(n):
        if ansarr[j] == '0':
            if a > 0:
                a -= 1
                ansstr += 'R'
            elif b > 0:
                b -= 1
                ansstr += 'P'
            else:
                c -= 1
                ansstr += 'S'
        else:
            ansstr += ansarr[j]
    if ans >= n / 2:
        print("YES")
        print(ansstr)
    else:
        print("NO")


"""T=int(input())
for _ in range(0,T):
    N=int(input())
    a,b=map(int,input().split())
    s=input()
    s=[int(x) for x in input().split()]
    for i in range(0,len(s)):
        a,b=map(int,input().split())"""


T=int(input())
for _ in range(0,T):
    N=int(input())
    a,b,c=list(map(int,input().split()))
    s=input()
    ct=0
    ans=''
    for i in range(0,len(s)):
        if(s[i]=='R'):
            if(b>0):
                b-=1
                ans+='P'
                ct+=1
            else:
                ans+='.'
        elif(s[i]=='P'):
            if(c>0):
                c-=1
                ans+='S'
                ct+=1
            else:
                ans+='.'
        else:
            if(a>0):
                a-=1
                ans+='R'
                ct+=1
            else:
                ans+='.'

    tg=N//2
    if(N%2!=0):
        tg+=1
    if(ct>=tg):
        print('YES')
        ans1=[]
        for i in range(0,len(ans)):
            ans1.append(ans[i])
        for i in range(0,len(ans1)):
            if(ans1[i]=='.'):
                if(a>0):
                    ans1[i]='R'
                    a-=1
                elif(b>0):
                    ans1[i]='P'
                    b-=1
                elif(c>0):
                    ans1[i]='S'
                    c-=1

        fnl=''.join(ans1)
        print(fnl)
                
    else:
        print('NO')

    
        


import sys
t=int(sys.stdin.readline())
# t=1
for i in range(t):
    n=int(sys.stdin.readline())
    a,b,c=list(map(int,sys.stdin.readline().strip().split()))
    x=list(sys.stdin.readline())
    op=[' ']*n
    # print(op)
    # print(x)
    
    if(n%2==0):
        w=n//2
    else:
        w=n//2+1
        
    z=0
    for j in range(n):
        if(x[j]=='R'):
            if(b>0):
                b-=1
                z+=1
                op[j]='P'
        elif(x[j]=='S'):
            if(a>0):
                a-=1
                z+=1
                op[j]='R'
        elif(x[j]=='P'):
            if(c>0):
                c-=1
                z+=1
                op[j]='S'
    for j in range(n):
        if(op[j]==' '):
            if(a>0):
                a-=1
                op[j]='R'
            elif(b>0):
                op[j]='P'
                b-=1
            elif(c>0):
                op[j]='S'
                c-=1
    if(z>=w):
        print("YES")
        print("".join(op))
    else:
        print("NO")