#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    string s;
    cin >> s;
    pair<int, char> p[3];
    for (int i = 0; i < s.length(); i++) {
      if (s[i] == 'R') p[0].first++;
      if (s[i] == 'S') p[1].first++;
      if (s[i] == 'P') p[2].first++;
    }
    p[0].second = 'P';
    p[1].second = 'R';
    p[2].second = 'S';
    sort(p, p + 3);
    for (int i = 0; i < s.length(); i++) cout << p[2].second;
    cout << endl;
  }
}
