#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    string s;
    cin >> s;
    int cp = 0, cs = 0, cr = 0;
    for (int i = 0; s[i]; i++) {
      if (s[i] == 'P') cp++;
      if (s[i] == 'S') cs++;
      if (s[i] == 'R') cr++;
    }
    if (cp >= cs && cp >= cr) {
      for (int i = 1; i <= s.length(); i++) cout << "S";
      cout << endl;
    } else if (cr >= cs && cr >= cp) {
      for (int i = 1; i <= s.length(); i++) cout << "P";
      cout << endl;
    } else if (cs >= cp && cs >= cr) {
      for (int i = 1; i <= s.length(); i++) cout << "R";
      cout << endl;
    }
  }
  return 0;
}
