//prewritten code: https://github.com/antma/algo
import std.algorithm;
import std.array;
import std.conv;
import std.math;
import std.range;
import std.stdio;
import std.string;
import std.traits;

class InputReader {
  private:
  ubyte[] p;
  ubyte[] buffer;
  size_t cur;
  public:
  this () {
    buffer = uninitializedArray!(ubyte[])(16<<20);
    p = stdin.rawRead (buffer);
  }
  final ubyte skipByte (ubyte lo) {
    while (true) {
      auto a = p[cur .. $];
      auto r = a.find! (c => c >= lo);
      if (!r.empty) {
        cur += a.length - r.length;
        return p[cur++];
      }
      p = stdin.rawRead (buffer);
      cur = 0;
      if (p.empty) return 0;
    }
  }
  final ubyte nextByte () {
    if (cur < p.length) {
       return p[cur++];
    }
    p = stdin.rawRead (buffer);
    if (p.empty) return 0;
    cur = 1;
    return p[0];
  }

  template next(T) if (isSigned!T) {
    final T next ()  {
      T res;
      ubyte b = skipByte (45);
      if (b == 45) {
        while (true) {
          b = nextByte ();
          if (b < 48 || b >= 58) {
            return res;
          }
          res = res * 10 - (b - 48);
        }
      } else {
        res = b - 48;
        while (true) {
          b = nextByte ();
          if (b < 48 || b >= 58) {
            return res;
          }
          res = res * 10 + (b - 48);
        }
      }
    }
  }
  template next(T) if (isUnsigned!T) {
    final T next () {
      T res = skipByte (48) - 48;
      while (true) {
        ubyte b = nextByte ();
        if (b < 48 || b >= 58) {
          break;
        }
        res = res * 10 + (b - 48);
      }
      return res;
    }
  }
  final T[] nextA(T) (int n) {
    auto a = uninitializedArray!(T[]) (n);
    foreach (i; 0 .. n) {
      a[i] = next!T;
    }
    return a;
  }
}

immutable names = "RPS";

void main() {
  auto r = new InputReader;
  foreach (t; 0 .. r.next!uint) {
    immutable n = r.next!uint;
    auto cnt = r.nextA!uint(3);
    auto a = new char[n];
    auto b = new int[n];
    foreach (i; 0 .. n) {
      char c;
      int k = -1;
      do {
        c = r.nextByte ().to!char;
        foreach (o; 0 .. 3) {
          if (names[o] == c) {
            k = o;
          }
        }
      } while (k < 0);
      b[i] = (k + 1) % 3;
    }
    debug stderr.writeln ("b = ", b);
    int wins;
    foreach (k; 0 .. 3) {
      foreach (j; 0 .. n) {
        if (cnt[k] > 0 && b[j] == k) {
          --cnt[k];
          a[j] = names[k];
          ++wins;
        }
      }
    }
    debug stderr.writeln ("wins = ", wins);
    foreach (i; 0 .. n) {
      if (a[i] == char.init) {
        foreach (k; 0 .. 3) {
          if (cnt[k] > 0) {
            a[i] = names[k];
            --cnt[k];
            break;
          }
        }
      }
    }
    int req = n / 2;
    if (n & 1) ++req;
    if (wins >= req) {
      writeln ("YES");
      writeln (a);
    } else {
      writeln ("NO");
    }
  }
}
