#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long t;
  cin >> t;
  while (t--) {
    string s;
    cin >> s;
    long long rock = count(s.begin(), s.end(), 'R');
    long long pap = count(s.begin(), s.end(), 'P');
    long long scis = count(s.begin(), s.end(), 'S');
    if (rock >= pap and rock >= scis) {
      for (long long i = 0; i < s.size(); i++) cout << "P";
    } else if (pap >= rock and pap >= scis) {
      for (long long i = 0; i < s.size(); i++) cout << "S";
    } else {
      for (long long i = 0; i < s.size(); i++) cout << "R";
    }
    cout << "\n";
  }
}
