#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t;
  cin >> t;
  while (t--) {
    string s;
    cin >> s;
    int cntr = 0, cntp = 0, cnts = 0;
    cntr = count(s.begin(), s.end(), 'R');
    cntp = count(s.begin(), s.end(), 'P');
    cnts = count(s.begin(), s.end(), 'S');
    int n = s.length();
    if (cntr == cntp and cntp == cnts) {
      cout << s << endl;
    } else {
      string ans1, ans2, ans3;
      for (int i = 0; i < n; ++i) {
        ans1 += 'R';
        ans2 += 'P';
        ans3 += 'S';
      }
      int mx = max({cntr, cntp, cnts});
      if (mx == cntr)
        cout << ans2 << endl;
      else if (mx == cnts)
        cout << ans1 << endl;
      else
        cout << ans3 << endl;
    }
  }
}
