#include <bits/stdc++.h>
using namespace std;
const long long int INF = 1e18;
const long long int MOD = 1e9 + 7;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int TT = 1;
  cin >> TT;
  while (TT--) {
    long long int n, m, k = 0;
    string s;
    cin >> s;
    n = s.length();
    map<char, long long int> mp;
    for (long long int i = 0; i < n; ++i) mp[s[i]]++;
    long long int gm = -INF;
    char ch;
    for (auto it : mp) {
      if (gm < it.second) {
        gm = it.second;
        ch = it.first;
      }
    }
    map<char, char> res;
    res['R'] = 'P';
    res['S'] = 'R';
    res['P'] = 'S';
    ch = res[ch];
    for (long long int i = 0; i < n; ++i) cout << ch;
    cout << '\n';
  }
  return 0;
}
