#include <bits/stdc++.h>
using namespace std;
bool pas = false;
int main() {
  int tc = 1;
  scanf("%d", &tc);
  while (tc--) {
    int n;
    scanf("%d", &n);
    string s;
    cin >> s;
    int r = 0, p = 0, second = 0;
    for (int i = 0; i < (int)s.size(); ++i) {
      if (s[i] == 'R') {
        p++;
      }
      if (s[i] == 'P') {
        second++;
      }
      if (s[i] == 'S') {
        r++;
      }
    }
    int mx = max(r, max(p, second));
    char ans;
    if (r == mx)
      ans = 'R';
    else if (p == mx)
      ans = 'P';
    else if (second == mx)
      ans = 'S';
    for (int i = 0; i < (int)s.size(); ++i) cout << ans;
    printf("\n");
    ;
  }
}
