← Home
package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()

	var t int
	if _, err := fmt.Fscan(in, &t); err != nil {
		return
	}

	for i := 0; i < t; i++ {
		var n, a, b, c int
		fmt.Fscan(in, &n, &a, &b, &c)
		var s string
		fmt.Fscan(in, &s)

		res := make([]byte, n)
		wins := 0

		for j := 0; j < n; j++ {
			if s[j] == 'R' && b > 0 {
				res[j] = 'P'
				b--
				wins++
			} else if s[j] == 'P' && c > 0 {
				res[j] = 'S'
				c--
				wins++
			} else if s[j] == 'S' && a > 0 {
				res[j] = 'R'
				a--
				wins++
			} else {
				res[j] = '_'
			}
		}

		if wins >= (n+1)/2 {
			fmt.Fprintln(out, "YES")
			for j := 0; j < n; j++ {
				if res[j] == '_' {
					if a > 0 {
						res[j] = 'R'
						a--
					} else if b > 0 {
						res[j] = 'P'
						b--
					} else if c > 0 {
						res[j] = 'S'
						c--
					}
				}
			}
			fmt.Fprintln(out, string(res))
		} else {
			fmt.Fprintln(out, "NO")
		}
	}
}